Can I save my callback function within a .fig file?
11 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
MathWorks Support Team
am 5 Mai 2017
Beantwortet: MathWorks Support Team
am 5 Mai 2017
I have a .fig file with a custom callback function. When I save a .fig file and reopen the figure, this functionality is lost unless I have the callback function saved on the path. Is there a way to save the callback function in the figure, or have the figure automatically add the callback function to the path?
Akzeptierte Antwort
MathWorks Support Team
am 5 Mai 2017
It is not currently possible to save the code for the callback function inside of the ".fig" file or have the figure add the callback function to the path, however there is a possible workaround.
Instead of saving the figure directly as a ".fig" file, you can instead save a function or script which can generate this file. Note that this script can the original program which made the figure, or a new file to simply load the necessary data in order to recreate the figure. Once this script or function exists, you can then define the desired callback function as a local function within your file. This way, whenever you want to view the figure, you will also have access to the appropriate callback function.
Note: The ability to define local functions within a script was introduced in the R2016b release of MATLAB.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Interactive Control and Callbacks finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!