Return a fixed matrix with m rows and n columns whose elements are taken from the fixed matrix a. To decide how to order the elements, Octave pretends that the elements of a matrix are stored in column-major order (like Fortran arrays are stored).
For example,
freshape (fixed(3, 2, [1, 2, 3, 4]), 2, 2) ans = 1.00 3.00 2.00 4.00If the variable
do_fortran_indexingis nonzero, thefreshapefunction is equivalent toretval = fixed(0,0,zeros (m, n)); retval (:) = a;but it is somewhat less cryptic to use
freshapeinstead of the colon operator. Note that the total number of elements in the original matrix must match the total number of elements in the new matrix.