references to unsavable objects when saving
4 views (last 30 days)
I am working on an app in MATLAB's app designer. I want to be able to save the app during a run so that the user can come back to a session. (why isn't this an automatic option?).
I tried to add a save function that saves the status of all the relevant buttons, context menus etc. the problem is that many of them reference the app itself. for instance, the app is linked to the parents of alll the buttons, many of the callback functions reference the app, context menus are linked to the app, etc.
MATLAB refuses to save anything that has to do with the app, prompting "unable to save app designer object. save is not supported for matlab.apps.AppBase objects"
I am looking for a way around this. my thought is perhaps to find automaticaly all references to a specific object (The app) and replace them with references to a dummy variable, that will be replaced again by the app when loading.
would be thankful for any assistance
Shivam Ahuja on 17 Aug 2021
I understand that you want to directly save the session as it is. This Feature is not directly available but it will be available in upcoming releases. Thank you for taking time to improve our products.
A possible workaround that you can refer is:-
1. One solution could be to save all the data of a session (for example the status of all buttons, current values of context menus, etc) in a MAT-file and then read from that MAT file whenever the app is created/opened again. What I meant was that suppose your app designer has an edit field and a drop-down. Then while closing the app, you can have a close call back and in that function, query for the edit field and drop-down value and save them in a mat file. Then when you open the app next time, check if such a mat file exists and load those values. Else load the default values
2. If you are looking to do this directly in App Designer, you can create a separate MATLAB class to store all the "backend" properties (i.e. the data) that needs to be saved out. For example, if you create an "Analysis" class, then in App Designer, you can create a single property, i.e. "Data" and instantiate the Analysis object. You would need to program save/load logic to be able to save/load Data (Analysis) to MAT file or something else they'd prefer.
Please Refer to below link for older releases: