[scilab-Users] Keeping track of for loops

Matthew Albrecht mattyalbrecht at gmail.com
Sat Mar 1 03:57:01 CET 2008


Thanks, works well.

On 29/02/2008, Eric Dubois <grocer.toolbox at gmail.com> wrote:
>
> 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/20080301/e8c62b5a/attachment.htm>


More information about the users mailing list