fabien van mook

all packages "fvm-*"

package "fvm-valuetocode"

function file "reshapeto1d.m"

Function y = reshapeto1d(x)
         y = reshapeto1d(x,dim)

returns the column vector obtained by stacking either the
columns or the rows of each page of matrix x one above the
other. Matrix x may be of any dimension; x may also be a a
cell-array of any dimension.

If the second input argument dim equals to 2, rows of x
are stacked (row-major ordre). Otherwise, and at default,
columns of x are stacked (column-major ordre). Stacking is
performed per page of x (i.e. per third and higher
dimension).

Function reshapeto1d is a generalised version of issuing
vec(x) or vec(x'). The latter expression accepts only one-
and two-dimensional matrices.


(c) 2026 fabien van mook

2026.08.20 release of this file within package "fvm-valuetocode" under GNU GPLv3+