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.
Need help with sort_nat function
8 次查看(过去 30 天)
显示 更早的评论
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
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Search Path 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!