strcmp isn't comparing properly
Ältere Kommentare anzeigen
I'm having trouble figuring out why the strcmp is providing an incorrect output when comparing PSymbol and symbol. The two cells are identical but when comparing strcmp(PSymbol,symbol) it should return a 1 and change location to 1 but it is not. Please help.
% Find the location in the table where symbols are matched
% Symbol is supposed to be unique in P
if strcmp(PSymbol,symbol)
location = i;
% If sides are opposite, flag as a closing transaction
if strcmp(side,oppSide1)
open = 0;
end
end
Ive attached the code and the .mat file. Please help.
Akzeptierte Antwort
Weitere Antworten (1)
Image Analyst
am 2 Jul. 2017
0 Stimmen
If they're cell arrays, try ismember() instead of strcmp().
Kategorien
Mehr zu Operations on Strings finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!