convert Axis to matrix of coordinates

5 visualizaciones (últimos 30 días)
jack
jack el 6 de Ag. de 2015
Respondida: Walter Roberson el 7 de Ag. de 2015
I need you help in converting axis to matrix of coordinates so that i will get the coordinates ,according the axis, of all points in the figure. Is this feasible , can It be done?
For example : look in http://imgur.com/YmUPl0S
here the x coordinate should start about ~-4.3 and end in ~7.3 and the y coordinate should start about ~-4.3 and end in ~4.2 therefore i need all these coordinate in this figure so that for each point i will know it's coordinates according the axises. So can i make a matrix containing all these coordinates?
Please advise.
Thanks in advance.
  2 comentarios
Azzi Abdelmalek
Azzi Abdelmalek el 6 de Ag. de 2015
Editada: Azzi Abdelmalek el 6 de Ag. de 2015
[converting axis to matrix of indexes], what does that mean? indices of what?
jack
jack el 6 de Ag. de 2015
I have rewritten my question to make it more understandable.

Iniciar sesión para comentar.

Respuestas (2)

Azzi Abdelmalek
Azzi Abdelmalek el 6 de Ag. de 2015
Editada: Walter Roberson el 7 de Ag. de 2015
Jack, you are not converting anything. You are, maybe, looking for how to get the x-data and y-data from the plot. For example
x=0:0.21:10;
y=sin(x);
plot(x,y)
To get the data
h=findobj(gca,'type','line')
x=get(h,'xdata')
y=get(h,'ydata')
  3 comentarios
Azzi Abdelmalek
Azzi Abdelmalek el 7 de Ag. de 2015
What "all" means? in theory there are infinity of points. How many points do you want?
jack
jack el 7 de Ag. de 2015
Editada: jack el 7 de Ag. de 2015
if i take the figure and convert it to image i can access each pixel in the image , here i want that same but with coordinates regarding the axis of the figure. So can i take the figure and create a matrix of coordinates regarding the axis ?

Iniciar sesión para comentar.


Walter Roberson
Walter Roberson el 7 de Ag. de 2015
If what you have is a figure object (not an image) then findobj() the axes objects and for each of them get() the XLim and YLim properties. "All possible coordinates" of what is displayed will then be the union of the those regions. There may also be graphic objects that are outside what is visible; it is not clear that you are interested in those.
If what you have is an image, then see Jiro's File Exchange contribution

Categorías

Más información sobre Annotations en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by