Removing a column from a Matrix product in one expression

1 回表示 (過去 30 日間)
JC
JC 2021 年 4 月 20 日
コメント済み: JC 2021 年 4 月 20 日
In MATLAB I want to achieve the following in one expression,
C = A * B;
C = C(:, 2:end);
Naturally it'd be something like
C = (A * B)(:, 2:end);
However that gives me an invalid expression error. How do I do this properly?

採用された回答

David Fletcher
David Fletcher 2021 年 4 月 20 日
Strange as it may seem, try this
C= A * B(:, 2:end)
Terser is not always better, especially when things start to become confusing and ambiguous
  1 件のコメント
JC
JC 2021 年 4 月 20 日
Thanks. Interesting. This is actually a different method but does produce the correct solution.

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by