There might not be an exact function but you can use the following workaround to replicate its behavior.
After displaying the image you can use ‘ginput’ or enable ‘datacursormode’ to get the co-ordinates of the points between which you want to calculate the distance. You can then find the distance between those points using Euclidean formula and display it using ‘annotation’.
The following links might be helpful.
Hope this helps!
