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

To resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016

getting x values by clicking on axes

Asked by Haykush on 4 May 2013

Hi all!

I have the set of (x,y) data:

x=[4 10 25 30 37 45 58 77 81 89 93 100 113 122 130 137 145 152 160 163]; y=[15 24 7 45 35 58 71 22 64 10 21 35 67 50 59 63 77 43 40 5];

After plotting it, I want to be able to get x values in t vector by clicking on the axes.

How can i do it?

2 Comments

per isakson on 4 May 2013

Why clicking on the axes? Why not by clicking on the curve?

Search for "Data Cursor" in the on-line help.

Haykush on 4 May 2013

Thanks, I'll try.

Haykush

Products

No products are associated with this question.

2 Answers

Answer by Azzi Abdelmalek on 4 May 2013

Click on your plot the add this code

x=get(gco,'xdata')
y=get(gco,'ydata')

15 Comments

Haykush on 4 May 2013

Can I send you the file by e-mail? (I upload it here, but it says that it can take a few days to show on this site)

Haykush on 4 May 2013

Please, check your e-mail.

Azzi Abdelmalek
Answer by Haykush on 4 May 2013

First of all, thanks so much for your attention.

For example, I need to fix N data by clicking to the x axis. What do you suggest to do in this case?

Thanks in advance.

0 Comments

Haykush

Contact us