freshape [fixed]
— Loadable Function: freshape (a, m, n)

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.00

If the variable do_fortran_indexing is nonzero, the freshape function is equivalent to

          retval = fixed(0,0,zeros (m, n));
          retval (:) = a;

but it is somewhat less cryptic to use freshape instead 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.