How to Compare strings
Show older comments
Hello,
I need to compare strings and sort in (even in alphabetical order) but without using
the sort code.
I run a code and I get the error message:
Undefined function or method 'gt' for input arguments of type 'cell'.
Error in ==> Untitled3 at 16 if stock(b)>stock(b+1)
Can anyone help on how to solve this or how to compare strings, or how to convert strings to numbers in order to compare them?
Many thanks
Panos
Accepted Answer
More Answers (1)
Robert Cumming
on 30 Apr 2011
Have you tried:
strcmp
to convert to numbers
str2num
Categories
Find more on Characters and Strings 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!