lexcmp
lexcmp(s1,s2) returns:
-1, if s1<s2
0, if s1=s2
1, if s1>s2
where the comparison is made on the first elements that differ. s1 and s2 can be strings, numeric arrays or other compatible objects (see the help for more details).
Although this has already been done a few times before, this implementation is among the most efficient and the core routine is in a form that easily translates to mex/C (something similar as a built-in function would be nice to have).
The core function is similar to S. Helsen's strcmpc.m with some performance tweaks. The function is vectorized for cell array input. Recent versions allow inf/nan values.
Cita come
Ben Petschel (2024). lexcmp (https://www.mathworks.com/matlabcentral/fileexchange/23035-lexcmp), MATLAB Central File Exchange. Recuperato .
Compatibilità della release di MATLAB
Compatibilità della piattaforma
Windows macOS LinuxCategorie
Tag
Riconoscimenti
Ispirato da: Compare Strings (C-convention)
Ispirato: String comparison, multisetdiff, jointable
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Scopri Live Editor
Crea script con codice, output e testo formattato in un unico documento eseguibile.