Borrar filtros
Borrar filtros

Implicit matrix expansion correction

1 visualización (últimos 30 días)
Garima Sharma
Garima Sharma el 20 de Jun. de 2017
Editada: Garima Sharma el 20 de Jun. de 2017
I have the following line of code (running in Matlab2016b), but which shows up with a "matrix dimensions must agree" error in Matlab2015a. How would I correct it? Thank you!
a=reshape(a(a ~= b(:,2)'),[],c);

Respuestas (1)

Guillaume
Guillaume el 20 de Jun. de 2017
It would have been helpful if you'd provided more details such as the size of a, b and c. Most likely,
a = reshape(a(bsxfun(@ne, a, b(:, 2)'), [], c);
would solve the problem. If not, provide more details.
While you're at it rename these extremely meaningless variable names to something a lot more meaningful.
  1 comentario
Garima Sharma
Garima Sharma el 20 de Jun. de 2017
Editada: Garima Sharma el 20 de Jun. de 2017
Thank you. a is 11x21, b(:,2)' is 1x21, and c is 21.

Iniciar sesión para comentar.

Categorías

Más información sobre Matrix Indexing 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