concatenating matrices of a cell vertically

조회 수: 1 (최근 30일)
Elia
Elia 2014년 1월 25일
댓글: Elia 2014년 1월 25일
i have a cell(1,n)=A of matrices (, the matrices have the same number of colums , and different number of rows . i want to concatenate all the matrices in the cell vertically using cat(1,M1,M2). i tried the following code ,but it doesn't work
for i=2:n
B(i-1)=cat(1,A{i-1},A{i});
end
B(:)
the following error appears
Error while evaluating uicontrol Callback
In an assignment A(I) = B, the number of elements in B and I
must be the same.
Error in Spro>export_button_Callback (line 1163)
B(i-1)=cat(1,A{i-1},A{i});
Error in gui_mainfcn (line 96)
feval(varargin{:});
Error in Spro (line 42)
gui_mainfcn(gui_State, varargin{:});
Error in
@(hObject,eventdata)Spro('export_button_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating uicontrol Callback

채택된 답변

Image Analyst
Image Analyst 2014년 1월 25일
What about this:
A = {ones(4,1),ones(5,1),ones(4,1),ones(5,1)}
allACells = cell2mat(A')

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by