% transforms a tensor with at least one single-plane dimension into a % matrix function a = tten2mat(t) if isempty(t), a = []; else % find the single-plane dimension tdim = tdimensions(t); [m,d] = min(tdim); if m ~= 1, error('the order of t is 3: cannot convert to a matrix') end % remove the tensor information a = t(:,(1:size(t,2)-1)); % 'i' matrices are stored as row vectors if d == 1, a = reshape(a,tdim(2),tdim(3)); end end