How to add zeros column and row at the beginning of matrix

12 次查看(过去 30 天)
I have A and B
A=[1,3,5;4,6,8;9,7,4]
B=[1,2,4,6;7,1,2,4;6,7,8,9;4,5,6,7]
if size(B)> size(A) Add zeros column and row at the beginning of matrix A
New_A=[0,0,0,0;0,1,3,5;0,4,6,8;0,9,7,4]

采纳的回答

KSSV
KSSV 2018-10-6
new_A=zeros(size(B));
new_A(2:end,2:end)=A;

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by