4.42857

4.4 | 16 ratings Rate this file 37 Downloads (last 30 days) File Size: 9.26 KB File ID: #2875
image thumbnail

dualcursor

by Scott Hirsch

 

20 Dec 2002 (Updated 21 Sep 2011)

Add dual vertical cursors to a plot.

Editor's Notes:

This file was selected as MATLAB Central Pick of the Week

| Watch this File

File Information
Description

Dual cursors are useful for picking relative measurements off of a plot; for instance - calculate the period of a time series, or the relative amplitude of two frequencies. A picture's worth a thousand words, so take a peek.

Key Features:
 - Basic syntax: dualcursor on / dualcursor off
 - Extended syntax supports a high level of control
 - Works with live data streams
 - Works in GUIDE guis
 - Includes delta calculations (x2-x2, y2-y1)
 - Export selected region to a new figure or to the workspace

Acknowledgements
This submission has inspired the following:
Speech Analysis using LPC
MATLAB release MATLAB 7 (R14)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (21)
23 Dec 2002 Denis Gilbert

Neat program for interactive data exploration !

26 Dec 2002 Poh Chee Khun

This is what I am looking for!

13 Jan 2003 Lisa Barker

Works great

12 Mar 2003 thomas toth

Very nice tool. Just what I needed for my data evaluation and extraction. Now it's as good as any simulation tool. Thanks for the tool.

13 Mar 2003 thomas toth

my plot contains multiple data sets (used hold on). is there a way to set the cursors on two different graphs as data source?
eg. measure x/y difference between two points on two graphs (data) within the same plot. could maybe done using left/right click of mouse?

26 Apr 2003 Paul Koola

Cool Tool

03 Aug 2003 Frank Hart

Not working for me. Shame, too, it could be so useful. I am using Matlab R11 (5.3), and
when I run the sample code and then call
dualcursor, I get this message back:

??? labelformatfcnh = @
                    |
Missing variable or function.

Syntax error in ==> C:\MATLAB_SR11\central\dualcursor.m
On line 147 ==> datalabelformatfcnh = @local_maketextstring;

20 Jul 2004 Alex Boboc

excelent

31 Mar 2005 Friedhelm Steinhilber

super!

26 Apr 2005 Tony Rainoldi

works great

30 Jul 2008 nicolas billard

Excellent. Only 1 thing : When i compile a soft which calls dualcursor, it turns. But it canno't turn when i deploy the soft on target pc with matlab runtime. May be it's due to the crypto aspect of dualcursor which is again crypted by compilation. Is it a solution for it?

04 Apr 2009 Hoi Wong

It seems like the program doesn't like figures being a child of uipanel:

??? Error using ==> set
There is no 'WindowButtonDownFcn' property in the 'uipanel' class.

Error in ==> dualcursor at 688
        set(get(axh,'Parent'),'WindowButtonDownFcn','','WindowButtonUpFcn','')

Error in ==> dualcursor at 220
        dualcursor('off',[],[],[],axh);

Error in ==> episodesPanel>slider_strip_Callback at 147
dualcursor([1 2], handles.panel.episodes.infoDisplay.axes_electrogram);
 
??? Error while evaluating uicontrol Callback

??? Error using ==> uicontextmenu
An object of class uicontextmenu, can not be a child of class uipanel.

Error in ==> dualcursor at 325
        cmenu = uicontextmenu('Parent',get(axh,'Parent'));

Error in ==> episodesPanel>slider_strip_Callback at 147
dualcursor([1 2], handles.panel.episodes.infoDisplay.axes_electrogram);
 

15 Apr 2009 Scott

Is it possible to have this function be "modal". For instance, if I wanted to use this function in a script that asks the user to set the lower and upper bounds of interest using dualcursor, how do I have my code stop and wait for the user to slide the vertical bars to the appropriate locations? I guess I need a button added to the plot so that the program waits until the limits are set before the user hits the "submit" button?

27 Oct 2009 Roy

If you have multiple plots in one figure how do you select which one to select?
Really nice work.

08 Mar 2010 CĂ©dric DuchĂȘne

Thank you very much for this tool.

Is it possible to use this function on the horizontal axis ?
How do you think it should be difficult to add this ability to work in this case ? (Toogle mode vertical <--> horizontal)

Thank you again.

30 Sep 2011 rasam aliazizi

was gga do that my self but hey now i have it, thanks....

30 Sep 2011 rasam aliazizi  
07 Nov 2011 fatanssi mohamed

I would like to thank you very much for this precious work. And I need to ask you how we can have an additionnaly horizontal dual cursor at the same time in the same plot
Sincerly your's

07 Nov 2011 fatanssi mohamed  
29 Dec 2011 Francis

Another vote for horizontal cursors.

19 Jan 2012 Preston

Would it be possible to expand callback functionality so that I could call it within a GUI whenever a cursor was moved?

Please login to add a comment or rating.
Updates
07 Jan 2003

Small bug fix: Eliminated error when user clicked on the figure background.

14 Mar 2003

Small bug fix: Eliminated error when clicking on a line AFTER dualcursor has been turned off. Thanks to Hao Fang for catching this.

06 Jun 2003

Small bug fix: Eliminated error when clicking on a line AFTER dualcursor has been turned off. Thanks to Hao Fang for catching this.

24 Oct 2007

Now works (hopefully) with plot types that create compound (hggroup) objects, such as stem. Thanks to Ralph Schmidt for pointing out the bug.

09 Sep 2009

Enhancement - now works when axes is parented to uipanel.

16 Sep 2009

Small fix - now works when the axes is parented to a uipanel, too (I wrote the original back in the day when the figure was the only parent an axes ever had ...)

21 Oct 2009

A few small updates based on user feedback.

28 Oct 2009

A few small feature requests.

21 Sep 2011

Removed hype from description.

Tag Activity for this File
Tag Applied By Date/Time
annotation Scott Hirsch 22 Oct 2008 06:55:15
customization Scott Hirsch 22 Oct 2008 06:55:15
cursors Scott Hirsch 22 Oct 2008 06:55:15
cursor Scott Hirsch 22 Oct 2008 06:55:15
label Scott Hirsch 22 Oct 2008 06:55:15
ginput Scott Hirsch 22 Oct 2008 06:55:15
crosshair Scott Hirsch 22 Oct 2008 06:55:15
marker Scott Hirsch 22 Oct 2008 06:55:15
datalabel Scott Hirsch 22 Oct 2008 06:55:15
potw Cristina McIntire 07 Nov 2008 13:21:19
annotation Erik 18 Jan 2010 11:32:53
annotation Peter 12 Oct 2010 10:13:28
cursors Peter 12 Oct 2010 10:13:32
pick of the week Jiro Doke 11 Feb 2011 20:10:07
graphics Scott Hirsch 08 Jun 2011 06:32:51

Contact us at files@mathworks.com