Removing a column from a Matrix product in one expression

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?

 Accepted Answer

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 Comment

Thanks. Interesting. This is actually a different method but does produce the correct solution.

Sign in to comment.

More Answers (0)

Categories

Asked:

JC
on 20 Apr 2021

Commented:

JC
on 20 Apr 2021

Community Treasure Hunt

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

Start Hunting!