how to insert diganole of zeros in to matrix without using loops ?
1 回表示 (過去 30 日間)
古いコメントを表示
my question is simple how to change the main diagonel of nXn of random numers and change the main diagonle to zeroes ?
without using loops ?
0 件のコメント
採用された回答
madhan ravi
2019 年 3 月 3 日
a(logical(eye(size(a,1))))=0 % where a is your matrix
2 件のコメント
madhan ravi
2019 年 3 月 3 日
編集済み: madhan ravi
2019 年 3 月 3 日
logical indexing
Alternative (faster):
a(1:size(a,1)+1:end)=0
その他の回答 (0 件)
参考
カテゴリ
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!