Need help with sort_nat function

5 visualizzazioni (ultimi 30 giorni)
Maryam
Maryam il 26 Giu 2014
Commentato: Geoff Hayes il 27 Giu 2014
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 Commento
Geoff Hayes
Geoff Hayes il 27 Giu 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.

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Introduction to Installation and Licensing in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by