5.0

5.0 | 10 ratings Rate this file 450 downloads (last 30 days) File Size: 9.26 KB File ID: #2875

dualcursor

by Scott Hirsch

 

20 Dec 2002 (Updated 28 Oct 2009)

Code covered by BSD License  

Add dual vertical cursors to a plot.

Editor's Notes:

This file was selected as MATLAB Central Pick of the Week

Download Now | Watch this File

File Information
Description

This is a powerful, flexible, but easy to use dual cursor for MATLAB. 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 frequncies. 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)
Zip File Content  
Other Files dualcursor.m,
license.txt
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (14)
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.

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.

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
marker Scott Hirsch 22 Oct 2008 06:55:15
crosshair Scott Hirsch 22 Oct 2008 06:55:15
datalabel Scott Hirsch 22 Oct 2008 06:55:15
ginput Scott Hirsch 22 Oct 2008 06:55:15
potw Cristina McIntire 07 Nov 2008 13:21:19
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com