Expand variables so that they all have the same shape.
ovar1=apifun_expandvar(ivar1) [ovar1,ovar2]=apifun_expandvar(ivar1,ivar2) [ovar1,ovar2,ovar3]=apifun_expandvar(ivar1,ivar2,ivar3) [ovar1,ovar2,ovar3,...]=apifun_expandvar(ivar1,ivar2,ivar3,...)
a matrix of doubles, the input variable #1
a matrix of doubles, the output variable #1
This function expands input arguments of computationnal functions. This function provides flexiblity for functions which have sets of arguments with the same goal.
On input, the input arguments ivar1, ivar2, etc... may have different dimensions. On output, the output arguments ovar1, ovar2, etc... all have the same dimensions.
For example ivar1 may be a m-by-n matrix and ivar2 may be a scalar (actually, a 1-by-1 matrix). In this case, the output variable ovar1 is a copy of ivar1, but ovar2 is a matrix, with the same size as ivar1, and all entries set to ivar2.
If two matrices or more are input arguments, these matrices must have the same dimensions: if not, an error is generated.