Effacer les filtres
Effacer les filtres

Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

How to make .fig files private?

1 vue (au cours des 30 derniers jours)
Han Peng
Han Peng le 21 Avr 2015
Clôturé : MATLAB Answer Bot le 20 Août 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!

Réponses (1)

Cindy Solomon
Cindy Solomon le 22 Avr 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!

Cette question est clôturée.

Community Treasure Hunt

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

Start Hunting!

Translated by