comparison - isequal not returning true for element in cell array in MATLAB -
Any idea why this is not returning true ???
comments01a is the cell array of cells, although I am completely happy to convert it to matrix. However, cell2mat (comments01a) gives its error that it does not support cell arrays of cell arrays or objects (which it does one) and I do not know any of the options.
comments01a {1}
ans = '4'
Unequal (comments01a {1}, '4')
ans = 0
Because '4', in this case, the string is a cell with '4', therefore, the unequal is comparing it with a string of cells. Either the solution is:
strcmp (comments01a {1}, '4')
Or maybe this, if you actually nested the cells As your suggestion of the question:
strcmp (comments01a {1} {1}, '4')
If any of these You can try it, which replaces the '4' string with the number:
unequal (comments01a {1} {1}, 4)
Hope this helps. I know it's not, and I'll take another shot at it.
Comments
Post a Comment