MATLAB: Error using >= Matrix dimensions must agree

leless than or equal tomatrix dimensions must agree

I'm trying this code:
status = zeros(0,length(centroidA));
for i=1:length(centroidA)
if ED1_cell{i} >= ED2_cell{i}
status(i) = {'embedded'};
else
status(i) = {'malapposed'};
end
end
and here is the error: Error using >= Matrix dimensions must agree.
CentroidA, ED1_cell, ED2_cell are all 11×1 cell. How?

Best Answer

The question at the moment is not about the size of the cell arrays: it is about the size of the content of the cell arrays. For the >= operation to work, the data in the two cells must either be the same size or one of the two must be a scalar.
Watch out especially for character vectors: you can compare them using >= but only when the two are exactly the same length. This is different than the newer string() scalar objects, which can be compared with >= even if they are different lengths.