Info

この質問は閉じられています。 編集または回答するには再度開いてください。

How to make .fig files private?

1 回表示 (過去 30 日間)
Han Peng
Han Peng 2015 年 4 月 21 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
Hello all.
I created a 'private' folder and put all my functions called by the main program to that folder. It works well with functions that have no GUI or with functions whose GUI are developed purely by coding. But it fails with GUIs developed by GUIDE, which contain both .m files and .fig files.
Take 'general_plot_demo.m' as an example. It is developed by GUIDE, and has a corresponding .fig file.
When I try to run it, error massage comes out like this:
Error using load
Unable to read file 'general_plot_demo.fig'. No such file
or directory.
Since I want to load .fig files while do not want .fig files to be seen from outside, could there be a proper way to make .fig files private?
Thank you very much!

回答 (1 件)

Cindy Solomon
Cindy Solomon 2015 年 4 月 22 日
Hi Han,
This is a limitation of MATLAB wherein GUI's in a private directory or directories starting with '@' do not work properly even if the full path information is used. This is due to the fact that MATLAB files under a private directory can only be seen by MATLAB code in function files immediately above the private directory. Callbacks (including CreateFcn) do not work properly both in startup and when running. To work around this issue, place the MATLAB file and the FIG file in a directory that is on your MATLAB path.
For more information on saving GUIDE UIs, please see this link, as well as this one that explains the scope of private functions. Hope this helps!

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by