[scilab-Users] Keeping track of for loops

Eric Dubois grocer.toolbox at gmail.com
Fri Feb 29 09:24:45 CET 2008


Do :

for i=1:n
    execstr('x'+string(i)+'='+string(i))
end

Or more efficiently (but less general) :

execstr('x'+string([1:n])+'='+string([1:n])

Eric.


2008/2/29, Matthew Albrecht <mattyalbrecht at gmail.com>:
>
> I would like to keep track of the output of a for loop, so that each
> output is assigned sequentially to a new variable from 'x1' to 'xn'.
> In its most simplest form, I would like to be able to do this:
>
> for i=1:n
> x=i
> end
> x1=1
>
> x2=2
>
> ....
>
> xn=n
>
>
> Where currently it outputs
> x=1
>
> x=2
>
> ...
>
> x=n
>
>
> Thanks
> Matt
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20080229/5f985f68/attachment.htm>


More information about the users mailing list