jane
jane

Reputation: 567

Extract drawline coordinates in App designer

How can I get extract the x1, y1, x2, y2 from the roi.Position to matching variables (x1, y1, x2, y2)?

function drawLineButtonPushed(app, event)
   roi = drawline(app.myAxes)
   disp(roi.Position);
end

Upvotes: 0

Views: 122

Answers (1)

If_You_Say_So
If_You_Say_So

Reputation: 1293

drawline allows the user to a draw a line connecting two points A and B on the chosen axis. The XY positions of A ([Ax Ay]) and B ([Bx By]) are simply:

roi = drawline(app.myAxes);
Ax = roi.Position(1);
Bx = roi.Position(2);
Ay = roi.Position(3);
By = roi.Position(4);

Upvotes: 2

Related Questions