How to fix "Error using == Arrays have incompatible sizes for this operation." in this code?
1.755 views (last 30 days)
Hi, I am writing the following code:
for k = 1 : length(theFiles) % files are alreaady defined in original code
for q=1:43 % there are 43 inputs for arr
end %end of q loop
mx=max(cor); %conditioned arr
ixa=find(arr==mx,1) %find the location for which mx matches arr value the first instance
But when run, the result shows following:
Error using ==
Arrays have incompatible sizes for this operation.
Error in Untitled12 (line 264)
It is noteworthy that, the error shows only for certain image inputs. For other inputs, the code works fine.
How can I fix it?
KSSV on 7 Jul 2021
Error is clear, you are trying to equate arr and mx. Check do they have same dimensions? They have different dimensions that's why error.
A = rand(2) ; B = rand(2) ;
A == B % no error as the dimensions are same
C = rand(3) ;
A == C % error as the dimensions are different