Rank: 3861 based on 24 downloads (last 30 days) and 5 files submitted
photo

Stephan Wegerich

E-mail
Company/University
VGBio

Personal Profile:

 

Watch this Author's files

 

Files Posted by Stephan Wegerich View all
Updated   File Tags Downloads
(last 30 days)
Comments Rating
07 Jan 2014 STRNUMERIC Sorts a list of files (or strings) in a cell array based on numeric characters Author: Stephan Wegerich sorting, file listingstrings 6 3
  • 1.0
1.0 | 1 rating
15 Nov 2004 gen_pcode Generates p-code and corresponding help files automatically. Author: Stephan Wegerich pcode, help files, code distribution, utilities, miscellaneous 3 0
26 Feb 2004 MINMEANGRID Finds the region in a matrix with the minimum mean for a given size grid. Author: Stephan Wegerich matrices, matrix, grid, search, region, extract 1 0
25 Feb 2004 PLOT_LINES Plots vertical lines at points defined on the x-axis. Author: Stephan Wegerich specialized, plotting, vertical lines, plot, graphics, specialized plot 4 17
  • 4.5
4.5 | 20 ratings
25 Oct 2001 printmatrix formatted matrix display Author: Stephan Wegerich matrices, format, output, copy, paste, utilities 10 6
  • 4.625
4.6 | 8 ratings
Comments and Ratings by Stephan Wegerich
Updated File Comments Rating
08 Jan 2014 STRNUMERIC Sorts a list of files (or strings) in a cell array based on numeric characters Author: Stephan Wegerich

Thanks for the feedback. I should have made it more clear that this function is not meant to sort alphabetically at all. In fact, that was the main point of this function. The row cell array is an interesting issue that I failed to notice. Although, it's obviously simple to work around (Just use column cell arrays... Or insert str = str(:); at the beginning of the m-file). Lastly, it really doesn't make any sense to use this function if none of the strings in the cell array contain numeric values.

Comments and Ratings on Stephan Wegerich's Files View all
Updated File Comment by Comments Rating
09 Jan 2014 STRNUMERIC Sorts a list of files (or strings) in a cell array based on numeric characters Author: Stephan Wegerich Stephen Cobeldick

1. Not sorting alphabetically is of course a question of design, but as your example gives filenames, I suspect most users would expect 'file2a.txt' to sort before 'file2b.txt', etc. Do you have a situation where this would not be required?
2. Restrictions on the inputs should be noted in the documentation.
3. Actually it makes a lot of sense to sort even if the strings contain no numeric values: perhaps the function will be used to sort a list of end user-supplied filenames, or used in a GUI directory listing, or any other case where the user of this function has no control over the filename format. At the very least the strings should be returned and not just disappear without any warning:
strnumeric({'A';'B'}) -> {}

08 Jan 2014 STRNUMERIC Sorts a list of files (or strings) in a cell array based on numeric characters Author: Stephan Wegerich Stephan Wegerich

Thanks for the feedback. I should have made it more clear that this function is not meant to sort alphabetically at all. In fact, that was the main point of this function. The row cell array is an interesting issue that I failed to notice. Although, it's obviously simple to work around (Just use column cell arrays... Or insert str = str(:); at the beginning of the m-file). Lastly, it really doesn't make any sense to use this function if none of the strings in the cell array contain numeric values.

08 Jan 2014 STRNUMERIC Sorts a list of files (or strings) in a cell array based on numeric characters Author: Stephan Wegerich Stephen Cobeldick

Does not work in many cases: strings simply go missing if input is a row Cell Array, are not returned sorted according to alphabetic order if all of the digits are identical (which is probably what you to sort filenames), and empty strings disappear:

1. strnumeric({'';''}) -> {}
2. strnumeric({'b';'a'}) -> {}
3. strnumeric({'2b';'2a';'2z'}) -> {'2b';'2a';'2z'}
4. strnumeric({'a1','a2'}) -> {'a1'}
5. strnumeric({'1','2'}) -> {'1'}
6. strnumeric({'a','a'}) -> {}

There are (atleast) two other files on MATLAB Exchange that correctly provide this functionality without losing your strings. See Douglas Schwarz's version:
http://www.mathworks.com/matlabcentral/fileexchange/10959
or my own version with optional customizable numeric format:
http://www.mathworks.com/matlabcentral/fileexchange/34464

26 Oct 2012 printmatrix formatted matrix display Author: Stephan Wegerich Khairy Elsayed

10 Mar 2011 PLOT_LINES Plots vertical lines at points defined on the x-axis. Author: Stephan Wegerich Daniel

Thanks! it works fine.

Contact us