strcmp isn't comparing properly
Mostrar comentarios más antiguos
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.
Respuesta aceptada
Más respuestas (1)
Image Analyst
el 2 de Jul. de 2017
0 votos
If they're cell arrays, try ismember() instead of strcmp().
1 comentario
liu James
el 2 de Jul. de 2017
Categorías
Más información sobre Operations on Strings en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!