フィルターのクリア

making a 4 x 3 matrix with elements from a 3x7 matrix

12 ビュー (過去 30 日間)
Brandon
Brandon 2023 年 9 月 26 日
コメント済み: Brandon 2023 年 9 月 26 日
m1 is 3x7
m2 is 4x3
need to pull 4 columns from m1 to make the 4 rows for m2

採用された回答

David Goodmanson
David Goodmanson 2023 年 9 月 26 日
編集済み: David Goodmanson 2023 年 9 月 26 日
Hi Brandon,
m1 = rand(3,7)
m2 = m1(:,[1 3 4 5]).'
m1 =
0.0357 0.6787 0.3922 0.7060 0.0462 0.6948 0.0344
0.8491 0.7577 0.6555 0.0318 0.0971 0.3171 0.4387
0.9340 0.7431 0.1712 0.2769 0.8235 0.9502 0.3816
m2 =
0.0357 0.8491 0.9340
0.3922 0.6555 0.1712
0.7060 0.0318 0.2769
0.0462 0.0971 0.8235
for example, where the columns have been indicated. The .' takes the transpose, and it has to be used if m1 has any complex values, because ' takes the complex conjugate transpose.
  1 件のコメント
Brandon
Brandon 2023 年 9 月 26 日
Thank you, I didn't know that .' took the transpose.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by