No BSD License  

Highlights from
SORTN - sort textual lists

5.0

5.0 | 8 ratings Rate this file 7 Downloads (last 30 days) File Size: 5.49 KB File ID: #8399

SORTN - sort textual lists

by Oren Yagev

 

31 Aug 2005 (Updated 31 Aug 2005)

Sort text lists containing letters and numbers.

| Watch this File

File Information
Description

Sort cell array or char array in textual and numerical mode. Primary sort by first letter, secondary by second letter and so on. Numbers are considered an numerical values. The main interest in this function is that it can sort numbers with text, so string like 'a60' comes before 'a100'.
Designed specially for sorting files list.

MATLAB release MATLAB 6.5 (R13)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (8)
25 Jul 2006 Perry Johnson

very nice program that sorts numbers with text and outputs a very useful index. great work.

20 Oct 2006 Roberto Fuentes

Worked as a charm

12 Mar 2007 Scott Miller

Works as advertised! Good for sorting filenames rationally.

10 Jan 2008 Matt Sanders

Saved me a lot of time.

13 May 2008 Frank Scharnowski

Many thanks!

03 Oct 2008 Fleur De Nil

Very usefull!!
Many thanks.

18 Feb 2009 Matthias Klemm

Very usefull - saved me a lot of time!
But there is a problem (Matlab 2008b, don't know about older releases) if a string contains the letter 'i' which is treated as a complex number and the program errors out at a later point. Therefore I added the following to line 141: "|| strcmp(tempString(i),'i')" what fixes the bug.

30 Mar 2009 Ofir

Boy, it took me a long time to find the bug in how I was doing it (which is very poor to begin with). This really solves the issue completely.
Note that Matthias's fix is essential though!
Toda Oren!

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
strings Oren Yagev 22 Oct 2008 07:59:12
sortn Oren Yagev 22 Oct 2008 07:59:12
textual lists Oren Yagev 22 Oct 2008 07:59:12
cell array Oren Yagev 22 Oct 2008 07:59:12
string Oren Yagev 22 Oct 2008 07:59:12
utilities Oren Yagev 22 Oct 2008 07:59:12
char array Oren Yagev 22 Oct 2008 07:59:12
utilities Hyung-Sik Kim 10 Apr 2009 10:06:00

Contact us at files@mathworks.com