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?
0 件のコメント
回答 (1 件)
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;
1 件のコメント
Image Analyst
2015 年 3 月 10 日
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.
参考
カテゴリ
Help Center および File Exchange で Creating and Concatenating Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!