I was wondering what the rule is for using vectors as range in for-loop in Matlab?
For example,
range = [0.1:0.01:2]'; % wrong
range = [0.1:0.01:2]; % correct
for i = range
i
end
- Why is it that if
rangeis column vector, it will not work, while ifrangeis row vector, it will? - Will
i = rangebe interpreted asitaking each value ofrange, oriis assigned with vectorrange?
Thanks~