how get it?
1 回表示 (過去 30 日間)
古いコメントを表示
a=magic(5)
b=[1 3 2 4 5]
i want to get:
in 1 column i want to 1 element
in 2 column i want to 3 element
in 3 column i want to 2 element
in 4 column i want to 4 element
in 5 column i want to 5 element
ans:
17 6 7 21 9
0 件のコメント
採用された回答
Walter Roberson
2023 年 10 月 8 日
a=magic(5)
b=[1 3 2 4 5]
v = a(sub2ind(size(a), b, 1:size(a,2)))
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で MATLAB Compiler についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!