I have a matrice A 15*15 with random numbers , i wanna put zeros in arrays outside A(5:8,5:8) ,how can i do this?

1 次查看(过去 30 天)
I have a matrice A 15*15 with random numbers , i wanna put zeros in arrays outside A(5:8,5:8) ,how can i do this?

回答(1 个)

Star Strider
Star Strider 2015-3-10
One way:
A = rand(15);
B = zeros(15);
B(5:8, 5:8) = A(5:8, 5:8);
A = B;

类别

Help CenterFile Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by