Rank: 6147 based on 14 downloads (last 30 days) and 2 files submitted
photo

Justin Winokur

E-mail
Company/University
Duke University, Johns Hopkins University

Personal Profile:
Professional Interests:
Uncertainty Quantification

 

Watch this Author's files

 

Files Posted by Justin View all
Updated   File Tags Downloads
(last 30 days)
Comments Rating
22 Feb 2013 find_closest_row Find the index of a row within a larger array while allowing for a tolerance Author: Justin Winokur measurement, data exploration, tools 4 4
  • 5.0
5.0 | 1 rating
22 Feb 2013 comb Quickly generate all combination of integers up to specified value in each dimension Author: Justin Winokur statistics, matrix, mathematics 10 0
Comments and Ratings by Justin View all
Updated File Comments Rating
23 Feb 2013 find_closest_row Find the index of a row within a larger array while allowing for a tolerance Author: Justin Winokur

@Jan Simon,

Those are interesting points that I hadn't considered, though you would probably want to be more careful with how you specify tolerances anyway when you work with such large numbers.

Thanks for the feedback

03 Nov 2011 mfind Find matching rows or columns in a matrix Author: Marcello Ferro

I originally wrote the search with nested for loops (I know, I should be shot), but then to "optimize" it, I used ismember and find to make it better. Unfortunately, it slowed it down rather significantly. I was excited to see this code, but it turn out that it does it the same way. Too bad.

03 Nov 2011 mfind Find matching rows or columns in a matrix Author: Marcello Ferro

04 Feb 2011 savefig Save *cropped* figures to pdf, eps, png, jpeg, and tiff through Ghostscript. Author: Peder Axensten

This is a great program. I use it almost every day. It works well 99% of the time. Sometimes, if there is a really complicated plot, it does not export PDF as a vector file. In those cases, I use Matlab's print command to eps and then let Mac OS X convert the eps to pdf. Even eps2pdf command line doesn't do it.

Do you know what makes it fail to export vector images sometimes?

Either way, great program.

21 Jan 2011 NetCDF reader Reads NetCDF files into matlab structure Author: Paul Spencer

Thanks for this. In our group, a few people have the newer 2010 version of Matlab with a built in netCDF library. This is good for one of my machines that does not have it. A few tweaks to my own codes here and there to use it but it works nicely. I am using it under SUSE.

Comments and Ratings on Justin's Files View all
Updated File Comment by Comments Rating
08 Dec 2013 find_closest_row Find the index of a row within a larger array while allowing for a tolerance Author: Justin Winokur D.Chen, Fan

Determines distance based on a Euclidean distanceļ¼

26 Feb 2013 find_closest_row Find the index of a row within a larger array while allowing for a tolerance Author: Justin Winokur Simon, Jan

A relative tolerance can be useful, but as usual for small values (e.g. 1e-20) further problems will occur.

I think it is a more important problem, that your function does not perform what its name advertises: Not the *closest* row is replied, but the first one inside the tolerance. Although a message is displayed, I'd prefer to use another name or algorithm, e.g.:

[d, ind] = min(sum(bsxfun(@minus, full_array, row) .^ 2, 2));
if d > tol, ind = -1; end

Replying the empty matrix could be more intuitive than -1, when no matching row was found.

23 Feb 2013 find_closest_row Find the index of a row within a larger array while allowing for a tolerance Author: Justin Winokur Winokur, Justin

@Jan Simon,

Those are interesting points that I hadn't considered, though you would probably want to be more careful with how you specify tolerances anyway when you work with such large numbers.

Thanks for the feedback

23 Feb 2013 find_closest_row Find the index of a row within a larger array while allowing for a tolerance Author: Justin Winokur Simon, Jan

"(min(distance)-tol)<=eps" is a bad comparison: Imagine, that the distances and tolerance has a magnitude of 1e80. Then comparing with EPS is not sufficient - eps(tol) would be smarter.
Instead of calculating the square root of the distances, it would be much more efficient to compare the squared distances with the squared tolerance.
This would reply the row with the smallest distance, not the first one below the tolerance:
[value, found_index] = min(distance - tol)

Contact us