Need help with sort_nat function
8 views (last 30 days)
Show older comments
Dear All
I have a column of some names. The names include alphabets and numeric values (both +ve and -ve) and I want to order them both alphabetically and also numerically. I did a search on the net and found out that the function sort_nat should do this for me. I downloaded the file from MathWorks and copied it in the same folder as my source code. The code that I have is as follows:
fnames = dir('*.csv'); N_test = length(fnames); allNames = { fnames.name }; [S,INDEX] = sort_nat(c);
However, when I run my code, I get the following error:
Undefined function 'sort_nat' for input arguments of type 'cell'.
Error in Raw_Data_Analysis (line 18) [S,INDEX] = sort_nat(c);
I would appreciate it very much if you could help me with this issue.
Regards
1 Comment
Geoff Hayes
on 27 Jun 2014
Maryam - I was able to follow what you did above (though wasn't sure where the c came from in the sort_nat(c) and was able to get this function called successfully. I wonder if the location that you put the sort_nat.m file is not in the MATLAB search path. In the Command Window, type which sort_nat and check the return value. If you see something like 'sort_nat' not found. then the file must be placed in another directory that is in the MATLAB search path.
Answers (0)
See Also
Categories
Find more on Search Path 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!