concatenating matrices of a cell vertically

1 visualizzazione (ultimi 30 giorni)
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

Risposta accettata

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

Più risposte (0)

Categorie

Scopri di più su Migrate GUIDE Apps in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by