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:
Data cursor coordinates

Subject: Data cursor coordinates

From: Matt

Date: 30 Sep, 2009 21:39:01

Message: 1 of 8

Does anyone know if, when displaying images, it is possible to have the data cursor display 'ij' pixel coordinates, i.e. where X= RowNumber and Y=ColumnNumber?

The only thing I could think of trying is 'axis ij', but it made no difference.

Subject: Data cursor coordinates

From: Matt Fig

Date: 30 Sep, 2009 21:51:01

Message: 2 of 8

I don't know if the built-in data cursor can do this or not. I bet you could easily modify GUI_24 to do this though. As it is, the coordinates are displayed as a title.

http://www.mathworks.com/matlabcentral/fileexchange/24861

Subject: Data cursor coordinates

From: Dave Brackett

Date: 30 Sep, 2009 22:03:15

Message: 3 of 8

"Matt " <xys@whatever.com> wrote in message <ha0j5l$n43$1@fred.mathworks.com>...
> Does anyone know if, when displaying images, it is possible to have the data cursor display 'ij' pixel coordinates, i.e. where X= RowNumber and Y=ColumnNumber?
>
> The only thing I could think of trying is 'axis ij', but it made no difference.

You can customise the datatip. Right click on a datatip in the figure and go to 'edit text update function'. You can then edit the callback to return whatever you want in the output_txt variable.

Subject: Data cursor coordinates

From: Matt

Date: 30 Sep, 2009 23:30:36

Message: 4 of 8

"Dave Brackett" <davebrackett@hotmail.com> wrote in message <ha0kj3$rkp$1@fred.mathworks.com>...

> You can customise the datatip. Right click on a datatip in the figure and go to 'edit text update function'. You can then edit the callback to return whatever you want in the output_txt variable.
============

Thanks a lot (you too, Matt).

But this raises a few more questions (you'll have to bear with me, I don't do a lot of graphics programming and so I'm not very conversant with notions of events and callbacks).

The old call back function gets used whenever I open a new figure. How do I make it so that my custom callback is always used? How would I later restore the factory default?

Subject: Data cursor coordinates

From: Matt

Date: 1 Oct, 2009 09:33:03

Message: 5 of 8

OK. Never mind. I figured it out.

Thanks again.

Subject: Data cursor coordinates -- increasing precision or number of decimal places

From: Richard Sonnenfeld

Date: 7 Nov, 2009 19:05:03

Message: 6 of 8

I stumbled across the thread because I was looking for a way to change the
number of decimal digits (precision) displayed by the data cursor (or data-tip) as they
seem to call it. Four digits is not necessarily enough for fine work.

 It turns out to be easy -- once you think of it. The poster
figured out his question. I'll document what he discovered when he said "nevermind --
I got it."

1) Select Data Cursor tool and click a point on your plot
2) Right click the tool and select "Edit Text Update Function"
3) On line 8 you will see an expression "output_txt = ... (pos(1),4)...
(pos(1),4)...
4) Change the ,4's to ,7's or whatever level of precision you need.
5) Save the file as "custom_cursor.m" (or whatever you like
6) Next time you need to use the cursor, repeat step 1, but then Right Click and
select "Select Text Update Function". Now select your custom_cursor.m and
you will have your customized cursor.
7) The cursor always returns to its default state. For now, I don't mind selecting custom_cursor every time I need one. I'll be happy to have a suggestion on how to permanently change the cursor if someone feels like making one.

Subject: Data cursor coordinates -- increasing precision or number of decimal places

From: Steven Lord

Date: 8 Nov, 2009 23:31:12

Message: 7 of 8


"Richard Sonnenfeld" <pcardout@gmail.com> wrote in message
news:hd4gcv$mmi$1@fred.mathworks.com...
>I stumbled across the thread because I was looking for a way to change the
> number of decimal digits (precision) displayed by the data cursor (or
> data-tip) as they
> seem to call it. Four digits is not necessarily enough for fine work.
>
> It turns out to be easy -- once you think of it. The poster
> figured out his question. I'll document what he discovered when he said
> "nevermind --
> I got it."

*snip*

> I'll be happy to have a suggestion on how to permanently change the cursor
> if someone feels like making one.

Enable the data cursor using the DATACURSORMODE function and change the
Updatefcn property to use your custom text update function.

http://www.mathworks.com/access/helpdesk/help/techdoc/ref/datacursormode.html

If you want to automatically enable data cursor mode with your custom
Updatefcn whenever you create a figure, set the default Figure CreateFcn to
call DATACURSORMODE as I described above.

--
Steve Lord
slord@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ

Subject: Data cursor coordinates -- increasing precision or number of decimal places

From: Matthew

Date: 26 Mar, 2010 21:12:02

Message: 8 of 8

Thank you, now I have my custom datatip text update function enabled via my startup script.

"Steven Lord" <slord@mathworks.com> wrote in message <hd7ka5$lq$1@fred.mathworks.com>...
>
> "Richard Sonnenfeld" <pcardout@gmail.com> wrote in message
> news:hd4gcv$mmi$1@fred.mathworks.com...
> >I stumbled across the thread because I was looking for a way to change the
> > number of decimal digits (precision) displayed by the data cursor (or
> > data-tip) as they
> > seem to call it. Four digits is not necessarily enough for fine work.
> >
> > It turns out to be easy -- once you think of it. The poster
> > figured out his question. I'll document what he discovered when he said
> > "nevermind --
> > I got it."
>
> *snip*
>
> > I'll be happy to have a suggestion on how to permanently change the cursor
> > if someone feels like making one.
>
> Enable the data cursor using the DATACURSORMODE function and change the
> Updatefcn property to use your custom text update function.
>
> http://www.mathworks.com/access/helpdesk/help/techdoc/ref/datacursormode.html
>
> If you want to automatically enable data cursor mode with your custom
> Updatefcn whenever you create a figure, set the default Figure CreateFcn to
> call DATACURSORMODE as I described above.
>
> --
> Steve Lord
> slord@mathworks.com
> comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
>

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