MATLAB: How to return values from .mlapp to the .m caller

appdesignerMATLAB

I made a matlab application (.m) for which I want to setup some parameters using a parameter window built with appdesigner (.mlapp). I was perfectly able to send values from .m to .mlapp, but I am not able to make the oposite i.e. return values from the .mlapp to .m.
My parameter window just contains 2 sliders.
There is probably something I dont understand. Can someone help me on this. Thanks

Best Answer

An App designer UI is just a class. You can add functions and properties to this however you wish and access these from the scope in which you create the UI object.
In fact, last time I checked the uneditable code of the app designer UI had the ghastly feature that all the uicomponent properties have public access so all you need to do is something like this:
myApp = App( );
sliderVal = myApp.slider1.Value;
You will need to edit that as appropriate for your app name, slider name within the app etc and I don't remember off-hand if the property is called 'Value' for an app designer slider, but I assume it is.
Related Question