Can I save my callback function within a .fig file?

11 次查看(过去 30 天)
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?

采纳的回答

MathWorks Support Team
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 个)

类别

Help CenterFile Exchange 中查找有关 Interactive Control and Callbacks 的更多信息

标签

尚未输入任何标签。

产品


版本

R2015a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by