Need help with sort_nat function

8 次查看(过去 30 天)
Maryam
Maryam 2014-6-26
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 个评论
Geoff Hayes
Geoff Hayes 2014-6-27
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.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Search Path 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by