concatenating matrices of a cell vertically

1 view (last 30 days)
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

Accepted Answer

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

More Answers (0)

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!