Append rows at the end of Matrix
Show older comments
Hi,
a = [1 2 3 ; 4 5 6; 7 8 9]; --> 3x3 matrix
I want to insert at the end number of raws with same elements such as [5 5 5] and make the matrix 10 x 3 i.e. I want to insert 7 more raws with [5 5 5]. Please explain.
Accepted Answer
More Answers (2)
Michael Hawks
on 2 May 2019
Another method:
a = [1 2 3 ; 4 5 6; 7 8 9];
b=[5 5 5];
a( end+1, : ) = b;
or
a( :, end+1 ) = b';
1 Comment
Lan
on 3 Apr 2025
thank you, it helps.
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!