www.pudn.com > calibr8.zip > data2cols.m


function [array, dims, count] = data2cols(varargin)
%[array, dims, count] = data2cols(varargin)
%
%Convert data to columns and put them together to a matrix
%
%Input:
%  VARARGIN - arrays of data
%
%Output:
%  ARRAY   - matrix ot the size PROD(DIMS) x COUNT with the data arrays
%            as its columns
%  DIMS    - sizes of the data arrays
%  COUNT   - number of the data arrays
%
%Notes:
%  All input data should have the same dimensions.
%  In only one array is given, it is transformed to a matrix.
%
%See also:
%  JOIN
%
%Radim Halir, Charles University Prague, halir@ms.mff.cuni.cz
%Created: 25.2.1997
%Last modified: 4.6.1997

if (nargin > 1)
  array = join(varargin{:});
else
  array = varargin{1};
end

dims = size(array);
count = dims(end);
dims(end) = [];
array = reshape(array, prod(dims), count);