Why Don't We Use == To Compare Strings In Matlab
问题 I know it's commonly accepted that using strcmp is the proper way to compare strings, but my question is why? According to the help: A == B does element by element comparisons between A and B and returns a matrix of the same size with elements set to logical 1 where the relation is true and elements set to logical 0 where it is not. And all the toy examples I can come up with seem to work out. 回答1: strcmp also checks that the inputs are class char, e.g., strcmp('a',double('a')) returns false,