how would I randomly replace two elements in a row vector
古いコメントを表示
rn, i have:
y = char(randperm(27));
for i = 1:iter
ynew = randperm(numel(y), 2);
1 件のコメント
Rena Berman
2024 年 3 月 15 日
(Answers Dev) Restored edit
回答 (1 件)
Walter Roberson
2024 年 2 月 13 日
編集済み: Walter Roberson
2024 年 2 月 13 日
y = char(randperm(27) - 1 + 'A');
for i = 1:iter
idx = randperm(numel(y), 2);
ynew = y;
ynew(idx) = ynew([idx(2) idx(1)]);
end
カテゴリ
ヘルプ センター および 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!