Effacer les filtres
Effacer les filtres

Need help with sort_nat function

8 vues (au cours des 30 derniers jours)
Maryam
Maryam le 26 Juin 2014
Commenté : Geoff Hayes le 27 Juin 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 commentaire
Geoff Hayes
Geoff Hayes le 27 Juin 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.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Introduction to Installation and Licensing dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by