I am trying to measure the distance two points on an image and then use that distance as an input for some other function. Here is my code:"
h = imdistline(gca);
api = iptgetapi(h);
width = api.getDistance();
When I run it, I am able to drag and get the distance I want on the image, but the distance I get from using the getDistance is some default value it started with , when it opened and it does not change , even if I change it in the image. How can the variable width have the distance i measured before I press enter or any eye and close the image.