フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Vectorizing this Operation

1 回表示 (過去 30 日間)
Stuart
Stuart 2011 年 8 月 20 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
I have list of random permutations of length 3: [1 0 0], [0 1 0], [0 0 1], [1 1 0], ...
I have matrix of random values from 1 to 6 of size m by n. Where each value indexes a permutation.
I want to obtain the m by 3*n matrix where each index is replaced by its corresponding permutation. Advice?

回答 (1 件)

Walter Roberson
Walter Roberson 2011 年 8 月 20 日
It will look something like
reshape(perms(pidx(:),:).',size(pidx,2)*size(perms,2),[]).'
but I didn't bother testing it out to be sure it gets everything in the right place (it's my bedtime.)

この質問は閉じられています。

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by