Rank: 103 based on 671 downloads (last 30 days) and 13 files submitted
photo

Douglas Schwarz

E-mail
Company/University
University of Rochester
Lat/Long
43.122913, -77.62703

Personal Profile:

I work in the Dept. of Biomedical Engineering at the University of Rochester where our lab is studying the auditory processing of complex sounds. I also teach an introductory MATLAB class to BME students. I have been using MATLAB since 1987.


 

Watch this Author's files

 

Files Posted by Douglas Schwarz View all
Updated   File Tags Downloads
(last 30 days)
Comments Rating
30 May 2013 Screenshot figmenu: An automatic figure-selection menu Easily switch between figures using a menu that is created automatically. Author: Douglas Schwarz figure, menu 5 0
02 Mar 2012 Screenshot uipickfiles: uigetfile on steroids Many-featured, platform independent file and directory picker. Author: Douglas Schwarz gui tools, example, uigetfile uigetfiles ..., multiple file selecti..., potw, pick of the week 90 81
  • 4.96
5.0 | 52 ratings
20 Feb 2012 csprintf: Write formatted strings to cells. Write text into a cell array of strings. Author: Douglas Schwarz utility, strings, sprintf 7 0
22 Jan 2011 sort_nat: Natural Order Sort Sort strings in natural order. Author: Douglas Schwarz strings, sort, natural order, digits, utilities, string manipulation 119 35
  • 4.9697
5.0 | 35 ratings
05 Nov 2010 uibutton: GUI pushbuttons with better labels Creates pushbutton uicontrol labeled with TeX or LaTeX strings. Author: Douglas Schwarz gui tools, example, pushbutton tex latex ... 55 10
  • 5.0
5.0 | 10 ratings
Comments and Ratings by Douglas Schwarz View all
Updated File Comments Rating
01 Nov 2014 Fast and Robust Curve Intersections Computes intersection points of two curves. Author: Douglas Schwarz

Pedro, thanks for the suggestion. I tried bsxfun when I first wrote this and it was not faster at that time. Perhaps things have changed so i will revisit it.

11 Jul 2014 Fast and Robust Curve Intersections Computes intersection points of two curves. Author: Douglas Schwarz

Ilya and Jan, because of floating point arithmetic, it's impossible to find intersections perfectly in all cases. Jan, your example has two curves that touch at a single point; some people might define this as an intersection. Your assertion that (0,0) isn't an intersection is debatable.

26 Jun 2014 sort_nat: Natural Order Sort Sort strings in natural order. Author: Douglas Schwarz

Maryam, make sure that sort_nat.m is in a folder that is on your MATLAB path. You can read more about the path with "doc path".

12 May 2014 Fast and Robust Curve Intersections Computes intersection points of two curves. Author: Douglas Schwarz

Deepak, you must install intersections.m into a folder that is on your MATLAB path. The error message is simply informing you that MATLAB cannot find the function.

07 Apr 2014 sort_nat: Natural Order Sort Sort strings in natural order. Author: Douglas Schwarz

Sergey,
Well, it's not a bug, but you might disagree with my logic. Remember, we are sorting strings, not numbers. '01' comes after '1' because they have the same numerical value, but '01' is a longer string. Likewise, '000' comes after '00', etc.
It may be possible to include '+-.,' by changing the regular expressions (currently just looking for runs of digits with '\d+'.

Comments and Ratings on Douglas Schwarz's Files View all
Updated File Comment by Comments Rating
01 Nov 2014 Fast and Robust Curve Intersections Computes intersection points of two curves. Author: Douglas Schwarz Douglas Schwarz

Pedro, thanks for the suggestion. I tried bsxfun when I first wrote this and it was not faster at that time. Perhaps things have changed so i will revisit it.

31 Oct 2014 Fast and Robust Curve Intersections Computes intersection points of two curves. Author: Douglas Schwarz Pedro

Thanks for this functions. It was very helpfull.
I would just remocomend the use of bsxfun instead of repmat, simpy because it's faster. The equivalent would be I believe:
[i, j] = find(bsxfun(@le, min(x1(1:end-1),x1(2:end)), max(x2(1:end-1),x2(2:end)).') & ...
bsxfun(@ge, max(x1(1:end-1),x1(2:end)), min(x2(1:end-1),x2(2:end)).') & ...
bsxfun(@le, min(y1(1:end-1),y1(2:end)), max(y2(1:end-1),y2(2:end)).') & ...
bsxfun(@ge, max(y1(1:end-1),y1(2:end)), min(y2(1:end-1),y2(2:end)).'));

Thanks again, Pedro

27 Oct 2014 Fast and Robust Curve Intersections Computes intersection points of two curves. Author: Douglas Schwarz Kevin

30 Sep 2014 uipickfiles: uigetfile on steroids Many-featured, platform independent file and directory picker. Author: Douglas Schwarz Muhammad Hussain

Hi Mr. Anderson,

This is an excellent tool.
Can you please tell that how could I rename the file inside any folder with that folder name.
And how could I create a new folder and add my renamed files in it.
And display my files as a list.

I want the above mentioned functions in addition to this tool.Please give me some hints to add these features.

Thanks

03 Aug 2014 sort_nat: Natural Order Sort Sort strings in natural order. Author: Douglas Schwarz Stephen Cobeldick

Sorting filenames using a sort function such as "sort_nat" can return non-user-intuitive ordering, as some longer filenames will sort before shorter filenames. This is due to char(0:45), including [ !"#$%&'()*+,-], sorting before the period '.' (char(46) used as the extension separator. For example:

fnm = {...
'test2.m';
'test.m';
'test10.m';
'test1.m';
'test-A.m';
'test_A.m';
'test10-old.m'};

% "sort" gives the wrong order for numeric substrings:
sort(fnm)
ans = {...
'test-A.m';
'test.m';
'test1.m';
'test10-old.m';
'test10.m';
'test2.m';
'test_A.m'}

% "sort_nat" gives numeric substrings in the correct order, but with '-' before '.':
sort_nat(fnm)
ans = {...
'test-A.m';
'test.m';
'test1.m';
'test2.m';
'test10-old.m';
'test10.m';
'test_A.m'}
% Note how 'test-A.m' occurs before the shorter named 'test.m', and likewise 'test10-old.m' before 'test10.m'. Users expecting shorter filenames to sort before longer ones need to sort using a different algorithm...

One solution is to sort the filename and file extensions separately, for which I wrote a function "natsortfiles":
natsortfiles(fnm, '\d+', 'beforechar')
ans = {...
'test.m';
'test1.m';
'test2.m';
'test10.m';
'test10-old.m';
'test-A.m';
'test_A.m'}

It allows control over case sensitivity, sort direction, and numeric substring matching. You can find this function on FEX here:
http://www.mathworks.com/matlabcentral/fileexchange/47434
It also accepts fullpaths, for which it sorts each level of the directory hierarchy separately too.

Contact us