From: Steven Lord on 4 Apr 2010 23:48 "vgsangiuliano Poretti" <vgsangiuliano(a)gmail.com> wrote in message news:hp6uk8$e2j$1(a)fred.mathworks.com... > Hi to all, > Can anyone say me how to use a field of a struct variable as a counter for > a FOR cicle? > > When I use > > for x.test=1:1:10 I get > | > Error: Unexpected MATLAB operator. > > of course using for x=1:1:10 is correct As us said, you can't do this. The closest approximation you can do is: for k = 1:10 x.test = k; % do the rest of the body of the loop end -- Steve Lord slord(a)mathworks.com comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
First
|
Prev
|
Pages: 1 2 Prev: setting upper bound and lower bounds in Optimization toolbox Next: need help with arrays |