How to change a range of numbers in a matrix to a random number of a matrix?
3 ビュー (過去 30 日間)
古いコメントを表示
採用された回答
Voss
2023 年 2 月 23 日
G = reshape(1:125,[25,5])
x = setdiff(0:24, 2:25)
idx = G >= 2 & G <= 25;
G(idx) = x(randi(numel(x),[nnz(idx),1]))
その他の回答 (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!