Thread Subject: Data cursor coordinates

Subject: Data cursor coordinates

From: Matt

Date: 30 Sep, 2009 21:39:01

Message: 1 of 7

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 7

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 7

"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 7

"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 7

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 7

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 7


"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

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

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.

Tag Activity for This Thread
Tag Applied By Date/Time
more precise cu... Richard Sonnenfeld 7 Nov, 2009 14:09:04
coordinates Sprinceana 1 Oct, 2009 02:47:01
data cursor Sprinceana 1 Oct, 2009 02:47:01
rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com