7 elseif ismatrix(inpCArr)
13 outArr{iCol}=
cat(2,inpCArr{iCol,:});
15 outArr=
cat(1,outArr{:});
17 outArr=cell(1, nCols);
19 outArr{iCol}=
cat(1,inpCArr{:,iCol});
21 outArr=
cat(2,outArr{:});
24 sizeVec=size(inpCArr);
26 for iDim=(nDims-1):-1:1
27 tmpCArr=cell([sizeVec(1:iDim) 1]);
28 tmpSizeVec=size(tmpCArr);
29 nTmpDims=numel(tmpSizeVec);
30 nTmpElems=prod(tmpSizeVec);
31 indColVecList=cell(1,nTmpDims);
32 [indColVecList{1:nTmpDims}]=ind2sub(tmpSizeVec,(1:nTmpElems).
'); 33 if nTmpDims==2 && tmpSizeVec(2)==1 34 indColVecList=indColVecList(1); 37 indRowVecList=mat2cell(num2cell([indColVecList{:}]),... 38 ones(1,nTmpElems),nTmpDims); 39 for iTmpElem=1:nTmpElems 40 indCurVecList=indRowVecList{iTmpElem}; 41 tmpCArr{indCurVecList{:}}=cat(iDim+1,... 42 inpCArr{indCurVecList{:},:}); 46 outArr=cat(1,inpCArr{:}); function cell2mat(in inpCArr)
CELL2MAT does the same as the built-in cell2mat function but a) 20% faster b) works with cell arrays ...
function cat(in dimNum, in varargin)