[scilab-Users] How to automatically increase matrix name number

Mathieu Dubois mathieu.dubois at limsi.fr
Fri Sep 24 10:38:39 CEST 2010


On 09/24/2010 10:05 AM, Carrico, Paul wrote:
> All,
> In a loop I would like to create several matrix but their size as well 
> as their number/name number depend on the file results (they're 
> automatically created).
> Is it possible that the name number becomes a variable ?
> for i = 1 : n
>     creation of A1[] / A2[] / A3[] .... An[]
> end for
> Please note each matrix size may be different
> Thanks for any advice
> Paul
>
Why not using a list of matrix (of course the name won't be A1, A2... 
but you can use A(1), ..., A(n) in a very natural way)... A simple example:

l=list();
n=5;
for i=1:n
   l($+1) = zeros(i, i); // Insertion is similar to matrix
end;

I think that lists are one of the big advantage of scilab over matlab.

Mathieu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20100924/bd822c66/attachment.htm>


More information about the users mailing list