[Scilab-users] Strange behaviour with for loops

Dang, Christophe Christophe.Dang at sidel.com
Wed Sep 30 10:26:47 CEST 2015


Hello,

> De Samuel Gougeon
> Envoyé : mercredi 30 septembre 2015 09:51
>
> Le 29/09/2015 16:20, Pierre Vuillemin a écrit :
> >
> > Is this behaviour intended?
>
> Yes, and it is as well documented:

Hint: you can transform any matrix A into a line vector using
A(:)'

So in the present case, try the following code and see the difference

idx = [1 2 3]';
for i = idx(:)'
     disp("newIter")
     disp(i)
end

Hope this helps

--
Christophe Dang Ngoc Chan
Mechanical calculation engineer
This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error), please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.



More information about the users mailing list