how to add a row to a matrix?
3 views (last 30 days)
Show older comments
A=[1;2;3;4;5]
i wanna add 0 to n row..i tried A(n, :) = 0...but i get this A=[0;2;3;4;5] instead of A=[0;1;2;3;4;5]
what's the problem?
0 Comments
Accepted Answer
KSSV
on 11 Jan 2022
Edited: KSSV
on 11 Jan 2022
Note that you want to append zero before to the first element of A. What you did is replace the first element of A with 0.
A=[1;2;3;4;5] ;
A = [0;A]
More Answers (0)
See Also
Categories
Find more on Resizing and Reshaping 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!