Azzera filtri
Azzera filtri

How to get the values on a given axis of a given figure ?

8 visualizzazioni (ultimi 30 giorni)
Hello,
I'm doing a little re-labeling function on an existing figure and I need to get the number of values on the X axis. The data plotted on the figure is supposed to be unknown, and I was wondering if it was possible to more generally retrieve the data values from the axes of any given figure.
Thank you very much for you help
all the best
L.

Risposta accettata

Azzi Abdelmalek
Azzi Abdelmalek il 16 Ott 2012
Modificato: Azzi Abdelmalek il 16 Ott 2012
x=0:0.1:10;
y=sin(x)
plot(x,y)
%select a plot in your figure, then run this:
xdata=get(gco,'Xdata') % to get X-axis data
Ydata=get(gco,'Ydata') % to get Y-axis data

Più risposte (1)

Léonard Roussel
Léonard Roussel il 17 Ott 2012
Thank you very much for your help.

Categorie

Scopri di più su Interactive Control and Callbacks in Help Center e File Exchange

Prodotti

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by