[Scilab-users] Strange behaviour with for loops
Pierre Vuillemin
contact at pierre-vuillemin.fr
Tue Sep 29 16:20:17 CEST 2015
Hello,
In the help, it is specified that the syntax 'for e = l ...' when l is a
list is authorised. When l is replaced by a vector, the result appears
to depend on whether its a column or row vector :
With this code, the for loops runs 3 times and each time i is equal to
another value of the vector idx
idx =[1 2 3];
for i = idx
disp("newIter")
disp(i)
end
When the vector idx is a column vector now, there is only one loop and i
is equal to the vector idx
idx = [1 2 3]';
for i = idx
disp("newIter")
disp(i)
end
Is this behaviour intended?
Pierre Vuillemin
More information about the users
mailing list