finding x and y coordinates

2 Ansichten (letzte 30 Tage)
Osita Onyejekwe
Osita Onyejekwe am 16 Nov. 2016
Beantwortet: Steven Lord am 16 Nov. 2016
I have a plot on matlab with points on the plot. I would like to find the x,y coordinates of these points. How do I do that? I want to eventually calculate the euclidean distance of points using the function distance square root (x^2 +y^2). I have no problem getting the x-coordinate indices, but I cannot get the y. I know you can use tools and data cursor to get the x and y coordinates. but i would like to hard code this.
Thank you

Akzeptierte Antwort

Steven Lord
Steven Lord am 16 Nov. 2016
Obtain the handle of the line, scatter plot, etc. in your figure. The findobj or allchild functions may be of use to you in this step. Then retrieve the properties of that object that contain the data. Usually those properties are called XData, YData, and ZData but it may be slightly different for different objects. Use get to show the list of properties and/or look at the documentation for the object whose handle you have for a list and an explanation of the properties.

Weitere Antworten (0)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by