How to rename a new matrix obtained by adding a row to the previous matrix
3 views (last 30 days)
Show older comments
A = [1:5; 6:10]
I want to add a new row A(3,:)=11
How to name this new matrix by a new variable name. At present the new matrix' name is A again. I want it as B.
How to rename a new matrix obtained by adding a row to the previous matrix
0 Comments
Accepted Answer
More Answers (1)
Walter Roberson
on 4 Apr 2025
A = [1:5; 6:10]
B = A;
B(3,:) = 11
4 Comments
Stephen23
on 4 Apr 2025
"But, will it affect the original matrix A?"
No, it will not affect A.
"I want A to be unchanged."
A will be unchanged.
See Also
Categories
Find more on Shifting and Sorting 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!