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 Ansicht (letzte 30 Tage)
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?

Antworten (1)

Star Strider
Star Strider am 10 Mär. 2015
One way:
A = rand(15);
B = zeros(15);
B(5:8, 5:8) = A(5:8, 5:8);
A = B;
  1 Kommentar
Image Analyst
Image Analyst am 10 Mär. 2015
Looks like it does the job. Akshit might want to Accept it to give you Reputation points, and might also accept some/most of his other questions also.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by