how to trace all the coordinates on the graph drawn by mouse pointer.

조회 수: 3 (최근 30일)
Pk Verma
Pk Verma 2021년 12월 4일
답변: DGM 2021년 12월 4일
please some can tell that how to find out all coordinates drawn by the mouse pointer and assign these coordinats in array.
for example let suppose this blue one curve is drawn by my mouse pointer, then how to find all the coordinate of this curve and assign into a array. ofcourse there should be a step size between the coordinates.
Thank You.

답변 (1개)

DGM
DGM 2021년 12월 4일
It depends what you mean by "drawn with the mouse". What are you using to draw with the mouse?
If you have IPT, you can use imfreehand() or drawfreehand()
% just make some dummy plot so that an axes exists
x = 1:10;
plot(x); hold on
% draw a curve and get the points
hf = drawfreehand(gca);
pointlist = hf.Position
delete(hf) % delete if unneeded
% show that point list corresponds to the drawn object
plot(pointlist(:,1),pointlist(:,2),'x:')
The spacing is velocity-dependent. You can reduce the relative spacing scale afterwards by simply subsampling the point list.

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by