Compare Strings (C-convention)
Version 1.0.0.0 (412 Bytes) by
Stijn Helsen
This function compares two strings using C-convention.
2.3K Downloads
Updated
22 Sep 2003
No License
This (old) function compares two strings and gives an output similar to the C-function strcmp.
Unlike the MATLAB strcmp function the strings are compared in the alphabetical order.
c=strcmp(s1,s2)
c : -1 if s1<s2, 0 if s1==s2, +1 if s1>s2.
(This is an old function, which I wanted to supply now....)
Cite As
Stijn Helsen (2026). Compare Strings (C-convention) (https://in.mathworks.com/matlabcentral/fileexchange/3987-compare-strings-c-convention), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Created with
R10
Compatible with any release
Platform Compatibility
Windows macOS LinuxCategories
Find more on Characters and Strings in Help Center and MATLAB Answers
Tags
Acknowledgements
Inspired: lexcmp, String comparison
Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
| Version | Published | Release Notes | |
|---|---|---|---|
| 1.0.0.0 |
