Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
how to get dataindex with getCursorInfo(dcm_obj) when the plot is NOT a line?

Subject: how to get dataindex with getCursorInfo(dcm_obj) when the plot is NOT a line?

From: Camille Couzi

Date: 22 Nov, 2010 16:07:04

Message: 1 of 2

Hi matlabers.
I am working with a kind od quiverplot (ipvd.m, you can find it in
http://www.mathworks.com/matlabcentral/fileexchange/25940-2d-progressive-vector-diagram

I plot two vectors of position in cartesian coordinates, x and y:
ipvd(x,y,0,0);

I am trying to make a datacursor update fcn, the problem is that as quiver is not a line kind of plot, when I call getcursorinfo, it returns me only Target and Position, and not DataIndex, because the 2D progressive diagram is made by making a cumsum...

if anybody has an idea it would be great
thanks in advance
Camille.

Subject: how to get dataindex with getCursorInfo(dcm_obj) when the plot is NOT a line?

From: Bill Winter

Date: 29 Apr, 2011 21:31:04

Message: 2 of 2

"Camille Couzi" <camillecouzi@yahoo.fr> wrote in message <ice4f8$3oj$1@fred.mathworks.com>...
> Hi matlabers.
> I am working with a kind od quiverplot (ipvd.m, you can find it in
> http://www.mathworks.com/matlabcentral/fileexchange/25940-2d-progressive-vector-diagram
>
> I plot two vectors of position in cartesian coordinates, x and y:
> ipvd(x,y,0,0);
>
> I am trying to make a datacursor update fcn, the problem is that as quiver is not a line kind of plot, when I call getcursorinfo, it returns me only Target and Position, and not DataIndex, because the 2D progressive diagram is made by making a cumsum...
>
> if anybody has an idea it would be great
> thanks in advance
> Camille.

The DataIndex property is present and documented for line objects. I've found that it's also present (but undocumented) for image objects. The following code illustrates:

temp = get(datacursormode(gcf),'DataCursors');
if isempty(temp), return; end % no data cursors
loc = get(get(temp(end),'DataCursorHandle'),'DataIndex');

loc will contain the location of your last data cursor in terms of the x,y indices of a line or image object.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us