'Matrix dimensions must agree' error on string operations
Show older comments
My code looks like:
data is 2x1 array.
data =
{'cont_box_A'}
{'cont_box_B'}
I'm trying to compare the string to another string, like:
if(data{1} == 'Test')
fprintf('Not the same')
else
fprintf('Same')
end
When I try to execute this, I get an error saying 'Matrix dimensions must agree'. don't really know what's wrong.
Accepted Answer
More Answers (1)
madhan ravi
on 10 Jun 2020
ismember(data{1}, 'Test')
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!