Cool! Very OT, but I had no idea about this behavior in MATLAB. Suddenly I'm going to be slightly less annoyed when I have to do xs = (x0:dx:x1)' to get my x-grid as a column vector.
Of course, Julia still beats this by far =) // T On Wednesday, May 14, 2014 7:54:55 AM UTC+2, Tony Kelman wrote: > > > Matlab uses the = version but only allows ranges on the right hand side > > Not quite, you can use other "iterables" (not that Matlab has a very > formal definition of the term) in Matlab for loops like arbitrary vectors > or cell arrays or matrices, but it's very particular about looping through > by column. So Matlab's > > for i=x > ... > end > > does what you expect if x is a row vector, but only performs one iteration > if x is a column vector, setting i to that entire vector. I suspect this > behavior is closely coupled to the reason ranges in Matlab are created as > row vectors. > > And we're all very happy to put these Matlab quirks behind us. >
