I am trying to design an app using Matlab 2017b with appdesigner. I want to attach a movable line to an image using the imline function. However, appdesigner appear to use a new type of object, uiaxes, whereas the imline function will only use the object axes.
Example of command that does work:
figure; taxes = axes; imline(taxes, [0 0], [0 1]);
Example of a command that does not work:
figure; tuiaxes = uiaxes; imline(tuiaxes, [0 0], [0 1]);
Questions
Is there a workaround for using imline with appdesigner? Is it still possible to use the old axes object? Is there some other way to have interactive lines on GUIs using the appdesigner?
To access the underlying "old
axesobject" of auiaxes, all we need to do isstruct(tuiaxes).Axes. Moving on - I tried playing around with this in R2018b, and I have some good and some bad news.imlineto a MATLAB figure by modifying theimlinefunction (<MATLAB>\R2018b\toolbox\images\imuitools\imline.m) function a bit.Here are the very basic steps:
imline.m, let's call itui_imline.m.cmenu), and line 317 (updateAncestorListeners(...)).Modify your code as follows:
This will result in:
If you want any other functionality besides dragging, you'll likely have to rewrite all uifigure-incompatible bits of
imlineyourself, or wait for an unknown future release that would do it for you.