Filter löschen
Filter löschen

How do I get the angle between three points input by ginput() in appdesigner?

1 Ansicht (letzte 30 Tage)
[x, y] = ginput(3);
app.UIFigure.HandleVisibility = fhv;
x = round(x);
y = round(y);
I received the input with ginput(), but I don't know how to convert it to angle.
(R2022b)

Akzeptierte Antwort

David Hill
David Hill am 30 Nov. 2022
Bearbeitet: David Hill am 30 Nov. 2022
z=[x,y];
d=diff(z);
Angle=acos(dot(-d(1,:),d(2,:))/norm(d(1,:))/norm(d(2,:)));
  1 Kommentar
채호 박
채호 박 am 30 Nov. 2022
Thank you so much. I just have a few questions.
If I receive input from ginput(6) and the angle between the first three points is angle1, then the angle between the third points is angle2
z=[x,y];
d=diff(z);
app.angle1=acos(dot(-d(1,:),d(2,:))/norm(d(1,:))/norm(d(2,:)));
app.angle2=acos(dot(-d(4,:),d(5,:))/norm(d(4,:))/norm(d(5,:)));
Is it right?
+) If I use angle1, 'Use app.angle1 to reference app properties' appears. Is this correct?
properties (Access = private)
angle1
end

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by