Why do I receive the error message "Arrays have incompatible sizes for this operation"?
Show older comments
Why does this error occur?
Arrays have incompatible sizes for this operation.
Error in fitting_method_iefa (line 238)
Different2 = sum((y-Convolution).^2);
4 Comments
Dyuman Joshi
on 6 May 2023
Edited: Dyuman Joshi
on 16 May 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
on 16 May 2023
Moved: Walter Roberson
on 21 Oct 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.
Thiripura Sundari
on 1 Mar 2025
Moved: Dyuman Joshi
on 1 Mar 2025
Arrays have incompatible sizes for this operation.
Error in guna1 (line 32)
RHS = (theta(2:end-1,j)/dt) + Ec*((diff(u(:,j))./dy).^2) - Q*0.5*(theta(3:end,j)-theta(2:end-1,j))
give answer
Dyuman Joshi
on 1 Mar 2025
@Thiripura Sundari, it would be much better if you ask a new question of your own and provide relevant information to solve the issue.
Also check this (self-explanatory) thread - TUTORIAL: how to ask a question (on Answers) and get a fast answer
Accepted Answer
More Answers (0)
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!