MATLAB: Subscripted assignment dimension mismatch.

MATLAB

for i=1:i
var(1,i) = find(m1==indexes(1,i));
end
error is var(1,i) = find(m1==indexes(1,i));

Best Answer

The result of the find is likely a vector, and it appears you are trying to stuff this vector into a scalar spot. Do you need all of the find results, or maybe just one of them? If you need all of them, can you use a cell array for var? What is var being used for downstream in your code?