Borrar filtros
Borrar filtros

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

1 visualización (últimos 30 días)
[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)

Respuesta aceptada

David Hill
David Hill el 30 de Nov. de 2022
Editada: David Hill el 30 de Nov. de 2022
z=[x,y];
d=diff(z);
Angle=acos(dot(-d(1,:),d(2,:))/norm(d(1,:))/norm(d(2,:)));
  1 comentario
채호 박
채호 박 el 30 de Nov. de 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

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by