Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Data cursor coordinates

790 views
Skip to first unread message

Matt

unread,
Sep 30, 2009, 5:39:01 PM9/30/09
to
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.

Matt Fig

unread,
Sep 30, 2009, 5:51:01 PM9/30/09
to
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

Dave Brackett

unread,
Sep 30, 2009, 6:03:15 PM9/30/09
to
"Matt " <x...@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.

Matt

unread,
Sep 30, 2009, 7:30:36 PM9/30/09
to
"Dave Brackett" <davebr...@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?

Matt

unread,
Oct 1, 2009, 5:33:03 AM10/1/09
to
OK. Never mind. I figured it out.

Thanks again.

Richard Sonnenfeld

unread,
Nov 7, 2009, 2:05:03 PM11/7/09
to
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.

Steven Lord

unread,
Nov 8, 2009, 6:31:12 PM11/8/09
to

"Richard Sonnenfeld" <pcar...@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
sl...@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ


Matthew

unread,
Mar 26, 2010, 5:12:02 PM3/26/10
to
Thank you, now I have my custom datatip text update function enabled via my startup script.

"Steven Lord" <sl...@mathworks.com> wrote in message <hd7ka5$lq$1...@fred.mathworks.com>...

aqsama...@gmail.com

unread,
Feb 21, 2018, 3:00:27 PM2/21/18
to
but why it does not increase the precision greater than sixteen digits
0 new messages