how to save results from every loop with permutation

2 ビュー (過去 30 日間)
Chenyang Zhang
Chenyang Zhang 2020 年 5 月 12 日
回答済み: darova 2020 年 5 月 12 日
a = [1 2 3; 4 5 6; 7 8 9];
idx = perms(1:size(a,2));
for ii = idx'
your_mat = a(:,ii)
end
I want to know how do I write a result matrix (in this case 18x3) that contains results from every loop. Thank you.

回答 (1 件)

darova
darova 2020 年 5 月 12 日
Use reshape
i = 1:9;
a = reshape(i,[],3);

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by