Why does MATLAB use column order?

I understand that C uses row order to store arrays, while MATLAB uses column order.

Is there any specific reason why MATLAB chooses the column order? Does MATLAB significantly benefit by preferring to arrange multidimensional arrays in a column in memory (i.e., columns are adjacent)?

+4
source share
1 answer

MATLAB uses column order for historical reasons.

The very early versions of MATLAB were implemented in FORTRAN and were largely based on the LINPACK and EISPACK FORTRAN libraries, which, unlike C, use column order. Although it was (mostly) converted to a C implementation, when it was initially commercialized, it retained the use of column order.

As far as I know, there are no inherent advantages or disadvantages for arrays of columns or rows, it is just a choice to be made anyway.

+1
source

All Articles