Removing a column from a Matrix product in one expression

1 visualización (últimos 30 días)
JC
JC el 20 de Abr. de 2021
Comentada: JC el 20 de Abr. de 2021
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?

Respuesta aceptada

David Fletcher
David Fletcher el 20 de Abr. de 2021
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 comentario
JC
JC el 20 de Abr. de 2021
Thanks. Interesting. This is actually a different method but does produce the correct solution.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre MATLAB en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by