Code covered by the BSD License  

Highlights from
Multiple Cursors

5.0

5.0 | 3 ratings Rate this file 1 Download (last 30 days) File Size: 4.71 KB File ID: #15156
image thumbnail

Multiple Cursors

by Thomas Montagnon

 

31 May 2007 (Updated 21 Jun 2007)

Cursor feature for MATLAB® plots

| Watch this File

File Information
Description

MYCURSORS creates as many cursors as you want on an axes.
Cursors can be tricky to implement and handle. This function will help you to simply add multiple cursors on an axes.

EXAMPLE:

Take a look at the example cursor_demo() to see how you can implement cursors using MYCURSORS.

USE:

  FH = MYCURSORS(VARARGIN) add cursor on an axes.
  
  VARARGIN can contain 0, 1 or 2 elements:
    1) First input is the handle of the axes on which you want to create the
       cursor.
       Default value is the current axes (GCA)
    2) Second input is the color of the cursor.
       Default value is red ('r' or [1 0 0])

  FH is a structure containing function handles that enable you to manipulate
  the cursor. FH structure looks like:
    FH.add(XPOS) : Adds a cursor on the same axes at the position x = XPOS.
                   XPOS is facultative. Default value is the middle of the
                   axes.
    FH.off(NUM) : Removes the NUMth cursor created
                   If NUM is a character string then the function removes only
                   the last cursor.
    FH.val(NUM) : Returns a vector containing the positions of the NUMth
                   cursor.
                   If you omit NUM then the function returns the position of
                   all cursors.
    FH.hdl() : Returns a matrix containing the handles of the cursors in
                   the first column and the handles of the associated labels
                   in the second column.

MATLAB release MATLAB 7.4 (R2007a)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (4)
13 Aug 2007 CAE Team

Tu l'as piqué sur MEGA !! Y'avait un copyright Lolo VAYLET dessus... Mais t'es pardonné, l'encapsulation est bonne. C'est pas du boulot de gitan ;-)

La CAE Team

04 Jul 2008 Didier PRADON

Très pratique pour éditer des évènements à partir d'un signal quelconque. A développer peut-être, dans l'exemple, une fonction pour récupérer en sortie les valeurs contenues dans "data". Merci et bravo.

09 Mar 2009 Tim

Function erroneously allows you to drag cursor beyond x axis limits, from where you cannot get back !

17 May 2011 jaja

Great work and well commented functions!
I'm working on a program where I have to use cursors like yours... I used your fonction and it works perfectly, but when I read your code, I couldn't find where do you use or create the fonction that allows you to drag the cursors (the lines)... I saw that you first created the Drag Cursor Shape , then the CurHotspot, the Cursor Line, and the Label associated to it (in the AddCursor() function). But I didn't understand how with only these initialisations, you can drag the "line" and "transform" it to a cursor ... Please if you can explain it to me I'll be very grateful.
Thank you, great work!
Best

Please login to add a comment or rating.
Updates
21 Jun 2007

Bug corrected when there was only one cursor the values couldn't be retrieved

Tag Activity for this File
Tag Applied By Date/Time
data exploration Thomas Montagnon 22 Oct 2008 09:14:04
cursors Thomas Montagnon 22 Oct 2008 09:14:04
cursor Thomas Montagnon 22 Oct 2008 09:14:04
interaction Thomas Montagnon 22 Oct 2008 09:14:04
graphics Thomas Montagnon 22 Oct 2008 09:14:04
multiple cursors Thomas Montagnon 22 Oct 2008 09:14:04
cursors jaja 12 May 2011 05:09:03

Contact us at files@mathworks.com