How can I add a column of zeros to a magic 5x5 matrix A to create a 5x6 matrix C?
2 次查看(过去 30 天)
显示 更早的评论
How can I add a column of zeros to a magic 5x5 matrix A to create a 5x6 matrix C? The element value in the 6th column should all be zero.
0 个评论
采纳的回答
Image Analyst
2014-6-17
编辑:Image Analyst
2014-6-17
Try this:
A = magic(5)
C = A; % Initialize a brand new matrix called C that is the same as A.
C(5,6) = 0 % Add column 6 that is all zeros.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Operating on Diagonal Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!