"Ben" wrote in message <email@example.com>... > "Andreas Lobinger" wrote in message <firstname.lastname@example.org>... > > Hello colleagues, > > i'm now into debugging for some time (~ 1h) until i recognized that Matlab > > has a quite surprising way of creating new variables. > > ... > > And now the punchline: > > > > >> a(idx_new) = par.height(net.bt(idx_new)) > > > > a = > > > > 10.5000 10.5000 10.5000 > > > > so although my righthand side is a column vector and my index to a is a > > column vector , the result in the new created a is a row vector.
> The moral of the example: If you want to store your vector in a column, you need to specify that directly.
Which is what i do now in the program. I had for some time the impression that the size of the index defines the field.
> As to why that is, I'm guessing a bit here, so I hope someone corrects me if I'm off, but I think MATLAB stores things in a row because it's faster. (If you do indexing through a matrix row by col vs col by row, you will see different speeds for large matrices.
This may be, however my experiences with linear addressing (which i use quite a lot) is that a linear index goes first dimenstion -which means columnwise- first.
But all this maybe have some historical backwards compatibility reasons.