Why do I receive the error message "Arrays have incompatible sizes for this operation"?

545 visualizaciones (últimos 30 días)
Why does this error occur?
Arrays have incompatible sizes for this operation.
Error in fitting_method_iefa (line 238)
Different2 = sum((y-Convolution).^2);
  2 comentarios
Dyuman Joshi
Dyuman Joshi el 6 de Mayo de 2023
Editada: Dyuman Joshi el 16 de Mayo de 2023
The reason is stated in the error - "Arrays have incompatible sizes for this operation."
For e.g., you can not subtract a 2x3 array from a 3x2 array. Thus, for substraction these arrays have incompatible size.
Check the size of the arrays "y" and "Convolution".
Walter Roberson
Walter Roberson el 16 de Mayo de 2023
Movida: Walter Roberson el 21 de Oct. de 2024
The story sometimes gets told that originally Loren phrased the error message as "Didn't Think Twice. Wasn't All Right." but that George didn't like The Greatful Dead and made her change the message.

Iniciar sesión para comentar.

Respuesta aceptada

Sourabh
Sourabh el 21 de Oct. de 2024
Editada: MathWorks Support Team el 21 de Oct. de 2024
The following error in MATLAB occurs when you try to perform operations (such as subtraction) on two arrays that have different sizes or dimensions that are not compatible with each other.
Arrays have incompatible sizes for this operation
You can understand array size compatibility from the following link:
Try using the "size" function to find out the dimensions of an array.

Más respuestas (0)

Categorías

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

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by