Discussion:
Data cursor coordinates
(too old to reply)
Matt
2009-09-30 21:39:01 UTC
Permalink
Raw Message
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
2009-09-30 21:51:01 UTC
Permalink
Raw Message
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
2009-09-30 22:03:15 UTC
Permalink
Raw Message
Post by Matt
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
2009-09-30 23:30:36 UTC
Permalink
Raw Message
Post by Dave Brackett
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
2009-10-01 09:33:03 UTC
Permalink
Raw Message
OK. Never mind. I figured it out.

Thanks again.
Richard Sonnenfeld
2009-11-07 19:05:03 UTC
Permalink
Raw Message
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
2009-11-08 23:31:12 UTC
Permalink
Raw Message
Post by Richard Sonnenfeld
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*
Post by Richard Sonnenfeld
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
***@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
Matthew
2010-03-26 21:12:02 UTC
Permalink
Raw Message
Thank you, now I have my custom datatip text update function enabled via my startup script.
Post by Steven Lord
Post by Richard Sonnenfeld
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*
Post by Richard Sonnenfeld
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
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
a***@gmail.com
2018-02-21 20:00:09 UTC
Permalink
Raw Message
but why it does not increase the precision greater than sixteen digits
Loading...