Search Comments and Ratings

go

   
Date File Comment by Comment Rating
01 Nov 2014 Fast and Robust Curve Intersections Computes intersection points of two curves. Author: Douglas Schwarz

Douglas Schwarz

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.

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

Douglas Schwarz

Pedro

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

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

Douglas Schwarz

Kevin

Kevin

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

Douglas Schwarz

Muhammad Hussain

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

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

Douglas Schwarz

Stephen Cobeldick

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.

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

Douglas Schwarz

Douglas Schwarz

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.

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

Douglas Schwarz

Jan

Jan

It also erroneously finds contact points (no real intersections).
Example: [x0, y0] = intersections([-1,0,-1], [-1,0,1], [1, 0, 1], [-1,0,1], 1);
returns point (0, 0) as intersection point although it isn't.

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

Douglas Schwarz

ENSTA

ENSTA

4
27 Jun 2014 uipickfiles: uigetfile on steroids Many-featured, platform independent file and directory picker. Author: Douglas Schwarz

Douglas Schwarz

Douglas Anderson

Douglas Anderson

This is a fantastic utility. I'm a bit confused about 'FilterSpec', 'REFilter', and 'Type'. If you want to have results of two filters displayed at the same time, such as all '*.xls' and '*.xlsx' files, is the only way to do that through the REFilter? Thanks for a great function.

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

Douglas Schwarz

Maryam

Maryam

Thank you very much. It is in the same folder. This is why I am very surprised.

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

Douglas Schwarz

Douglas Schwarz

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".

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

Douglas Schwarz

Maryam

Maryam

Hello. I wan to use this program to sort a vector a strings which have numerical values in their name. I am giving this error: Undefined function 'sort_nat' for input arguments of type 'cell'

what should I do?

5
17 Jun 2014 Fast and Robust Curve Intersections Computes intersection points of two curves. Author: Douglas Schwarz

Douglas Schwarz

Ilya

Ilya

An excellent function! However, if both intersecting curves already include the intersection point, weird results are possible (see the provided example). This problem was already touched by John Mahoney (the results were different).

My test case: several lines pass through one point and every line must eventually include this point. However, it's not known in advance that we have this situation, it simply may appear.

x1=[-0.49313932739246, -0.02127781500161, 0.450583697389237];
y1=[-10.01, 0, 10.01];
x2=[-1.22073877122679, -0.02127781500161, 1.17818314122357];
y2=[10.01, 0, -10.01];
[x,y,seg1,seg2] = intersections(x1, y1, x2, y2)

The case is published because it may be useful to know about. Otherwise I agree that the function works fine in 99,99999999% of cases.

5
17 Jun 2014 Fast and Robust Curve Intersections Computes intersection points of two curves. Author: Douglas Schwarz

Douglas Schwarz

p kung

p kung

exactly what i'm looking for.
thanks

5
12 Jun 2014 uibutton: GUI pushbuttons with better labels Creates pushbutton uicontrol labeled with TeX or LaTeX strings. Author: Douglas Schwarz

Douglas Schwarz

Nam

Nam

5
22 May 2014 sort_nat: Natural Order Sort Sort strings in natural order. Author: Douglas Schwarz

Douglas Schwarz

Morad Kassem

Morad Kassem

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

Douglas Schwarz

deepak gogade

deepak gogade

thanks to douglas sir. it is running .

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

Douglas Schwarz

deepak gogade

deepak gogade

where to find intersection.m file

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

Douglas Schwarz

deepak gogade

deepak gogade

hello sir i asked a question on mathwork ask the question please help me out this question.
i want to intersection point of curve by the .fig file
</matlabcentral/answers/uploaded_files/12588/Unti.jpg> this is my graph fig. i want to intersection point of efficiency & unit discharge at 100 unit speed & other unit speed. so how we use matlab code finding intersection of this.

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

Douglas Schwarz

Douglas Schwarz

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.

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

Douglas Schwarz

deepak gogade

deepak gogade

when i run the code
t= 0:pi/64:3*pi;
y = sin(t);
>> y2=cos(t);
>> [xout,yout] = intersections(t,y,t,y2,1);
plot(t,y,'linewidth',2)
set(gca,'xlim',[min(t) max(t)],'ylim',[-1.1 1.1])
hold on
plot(t,y2,'g','linewidth',2)
plot(xout,yout,'r.','markersize',18)

that problem is occured:-

"Undefined function 'intersections' for input arguments of type 'double'."

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

Douglas Schwarz

Elizabeth Jones

Elizabeth Jones

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

Douglas Schwarz

Douglas Schwarz

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+'.

Comment only
06 Apr 2014 Parse property/value pairs and structures Parses property/value pairs just like Handle Graphics functions. Author: Douglas Schwarz

Douglas Schwarz

Douglas Schwarz

Douglas Schwarz

Matthew,
Adding error IDs is a great idea -- I'll do that. I don't know about providing for objects though. My intent is make it accept property/value pairs just like Handle Graphics functions so that includes structures. If HG functions accept objects then I'll add that, but I wouldn't think there'd be much call for it. Thanks for your comments!

Comment only
06 Apr 2014 uipickfiles: uigetfile on steroids Many-featured, platform independent file and directory picker. Author: Douglas Schwarz

Douglas Schwarz

Douglas Schwarz

Douglas Schwarz

Dan K,
A favorites list is a great idea and I'm working on it. Also, you're right that the recent list fills up fast with intermediate folders so I've decided to put only destination folders in that list; I think that would be more useful. Thanks for the suggestions!

Comment only
06 Apr 2014 sort_nat: Natural Order Sort Sort strings in natural order. Author: Douglas Schwarz

Douglas Schwarz

Sergey

Sergey

Very fast! I can't beat it!

This might be a bug though, not sure?
sort_nat({'01E2' '1E3'})
ans = '1E3' '01E2'

I came up with a version that can treat '+-.,' as part of the number, but its 10x slower. Not sure if sort_nat can be extended to do same.

5
01 Apr 2014 Parse property/value pairs and structures Parses property/value pairs just like Handle Graphics functions. Author: Douglas Schwarz

Douglas Schwarz

Matthew Barrett

Matthew Barrett

This is an excellent submission, thank you!

I've made one minor extension in my version which allows this function to work with objects as well as structures. I haven't encountered any bugs because of it yet, but I can't guarantee that it's error free.

You could change the line:

elseif isstruct(arg)

to

elseif isstruct(arg) || isobject(arg)

For completeness/tidiness, you could also change the errors to include IDs (to allow user control of error management), so something like...

error('ParsePropVal:BadArgFormat', 'Properties must be specified by property/value pairs, structures, or objects.')

and

error('ParsePropVal:BadArgValue', 'Property ''%s'' does not exist or is ambiguous.', arg)

5
26 Mar 2014 uipickfiles: uigetfile on steroids Many-featured, platform independent file and directory picker. Author: Douglas Schwarz

Douglas Schwarz

Molly Rossow

Molly Rossow

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

Douglas Schwarz

Eric Sampson

Eric Sampson

5
27 Feb 2014 uipickfiles: uigetfile on steroids Many-featured, platform independent file and directory picker. Author: Douglas Schwarz

Douglas Schwarz

Dan K

Dan K

This is a fabulous tool. One "feature request" I would love to see is a favorites list. The recent list is great, but since it tracks every folder visited, it can fill up fast with the intermediate folders needed to navigate to your new destination. Given that I frequently need to shift between widely separated directories on network shares and local drives, having a favorites that I could just use to hop to at least the approximate location would be great!

Thanks.

5
26 Feb 2014 uipickfiles: uigetfile on steroids Many-featured, platform independent file and directory picker. Author: Douglas Schwarz

Douglas Schwarz

Adam

Adam

Great improvements over the Matlab function!

5
19 Feb 2014 sort_nat: Natural Order Sort Sort strings in natural order. Author: Douglas Schwarz

Douglas Schwarz

alex

alex

thank you very much!
i was typing C=[list.name] and not
C={list.name} which is the right.
thank you very much again!
very usefull function!

Comment only
19 Feb 2014 sort_nat: Natural Order Sort Sort strings in natural order. Author: Douglas Schwarz

Douglas Schwarz

Douglas Schwarz

Douglas Schwarz

Alex, your input has to be a cell array:

>> C = {'1.bmp','10.bmp','11.bmp','2.bmp'};
>> sort_nat(C)
ans =
'1.bmp' '2.bmp' '10.bmp' '11.bmp'

Comment only
19 Feb 2014 sort_nat: Natural Order Sort Sort strings in natural order. Author: Douglas Schwarz

Douglas Schwarz

alex

alex

5
19 Feb 2014 sort_nat: Natural Order Sort Sort strings in natural order. Author: Douglas Schwarz

Douglas Schwarz

alex

alex

i find this very useful,but i cant use it.

C =

1.bmp10.bmp11.bmp2.bmp

>> [S,INDEX] = sort_nat(C)

Cell contents reference from a non-cell array object.

Error in sort_nat (line 62)

num_val(i,z(i,:)) = sscanf(sprintf('%s ',digruns{i}{:}),'%f');

any help?

Comment only
02 Feb 2014 Fast and Robust Curve Intersections Computes intersection points of two curves. Author: Douglas Schwarz

Douglas Schwarz

Faraz Oloumi

Faraz Oloumi

Thank you!

5
23 Nov 2013 uipickfiles: uigetfile on steroids Many-featured, platform independent file and directory picker. Author: Douglas Schwarz

Douglas Schwarz

Daniel

Daniel

Never mind! I'm an idiot, figured out what I was doing wrong

Comment only
11 Nov 2013 sort_nat: Natural Order Sort Sort strings in natural order. Author: Douglas Schwarz

Douglas Schwarz

Calum

Calum

Very useful - worked was described! Thanks.

5
29 Oct 2013 sort_nat: Natural Order Sort Sort strings in natural order. Author: Douglas Schwarz

Douglas Schwarz

JiaDa

JiaDa

It work well and help a lot. So awesome!!!
Thank you

5
17 Oct 2013 uipickfiles: uigetfile on steroids Many-featured, platform independent file and directory picker. Author: Douglas Schwarz

Douglas Schwarz

Ryan Edwards

Ryan Edwards

5
08 Oct 2013 Fast and Robust Curve Intersections Computes intersection points of two curves. Author: Douglas Schwarz

Douglas Schwarz

Ted Shultz

Ted Shultz

Just what i was looking for! thanks

5
25 Sep 2013 sort_nat: Natural Order Sort Sort strings in natural order. Author: Douglas Schwarz

Douglas Schwarz

Dirk

Dirk

Thank you so much, saved me a lot of time! Dirk

5
06 Sep 2013 sort_nat: Natural Order Sort Sort strings in natural order. Author: Douglas Schwarz

Douglas Schwarz

Paul

Paul

5
28 Aug 2013 uipickfiles: uigetfile on steroids Many-featured, platform independent file and directory picker. Author: Douglas Schwarz

Douglas Schwarz

Douglas Schwarz

Douglas Schwarz

John,

Sorry for the delay -- somehow I missed your question.

Yes, you can show only folders by entering '^' as the regular expression filter. That will cause the program to display only files that begin with nothing. Since no file has no name and folders are exempt from RE filtering (by default), only folders will be displayed.

uipickfiles('REFilter','^')

I realize that's a bit of a hack so I will consider adding such a feature.

Doug

Comment only
28 Aug 2013 Fast and Robust Curve Intersections Computes intersection points of two curves. Author: Douglas Schwarz

Douglas Schwarz

Fran├žois Beauducel

Fran├žois Beauducel

Thanks.

5
27 Aug 2013 uipickfiles: uigetfile on steroids Many-featured, platform independent file and directory picker. Author: Douglas Schwarz

Douglas Schwarz

Elliott Liggett

Elliott Liggett

This is a great replacement for the honestly awful built-in file box.

To hide hidden files ("dot files"):
uipickfiles('REFilter', '^[^\.]', 'REDirs', true)

5
01 Aug 2013 sort_nat: Natural Order Sort Sort strings in natural order. Author: Douglas Schwarz

Douglas Schwarz

Erwin

Erwin

5
31 Jul 2013 uipickfiles: uigetfile on steroids Many-featured, platform independent file and directory picker. Author: Douglas Schwarz

Douglas Schwarz

John

John

5
31 Jul 2013 uipickfiles: uigetfile on steroids Many-featured, platform independent file and directory picker. Author: Douglas Schwarz

Douglas Schwarz

John

John

Hi Doug!

This is a great tool!

Is there some way that I could have the function only show folders (i.e. similar to uigetdir)?

Comment only
18 Jul 2013 sort_nat: Natural Order Sort Sort strings in natural order. Author: Douglas Schwarz

Douglas Schwarz

Yi Sui

Yi Sui

5

Contact us