Borrar filtros
Borrar filtros

Bug with max function

4 visualizaciones (últimos 30 días)
Matt
Matt el 3 de Dic. de 2014
Editada: Image Analyst el 3 de Dic. de 2014
I found a strange bug in MATLAB 2012a.
I have a script with a matrix A (6000x1 double) and a matrix B (6000x1 double). When I try to use the following function by running my script file: max(A,B) I get the following error:
Error using max Matrix dimensions must agree.
However, when I perform the same operation in the command window, everything works fine.
What is wrong?
  1 comentario
Adam
Adam el 3 de Dic. de 2014
Does your script contain a variable called max?

Iniciar sesión para comentar.

Respuestas (2)

Azzi Abdelmalek
Azzi Abdelmalek el 3 de Dic. de 2014
Check in your script that A and B are the same size, in command windows type
size(A)
size(B)

Matt
Matt el 3 de Dic. de 2014
Editada: Image Analyst el 3 de Dic. de 2014
Thank you for the answers guys.
No there is no variable called max.
Both matrices have the same size when entering what you told me Azzi: 6000 1.
And sorry I found the problem. The Answer turned out to be .....
The matrix B was originally taken from a structure, and even though I performed operations on that B matrix before arriving to that max operation, it kept the B matrix intact. Never mind, I just re-created the B matrix right before having to use the max function and it now works. Still strange.

Categorías

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

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by