Info

This question is closed. Reopen it to edit or answer.

How to make .fig files private?

1 view (last 30 days)
Han Peng
Han Peng on 21 Apr 2015
Closed: MATLAB Answer Bot on 20 Aug 2021
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!

Answers (1)

Cindy Solomon
Cindy Solomon on 22 Apr 2015
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!