GUI Set Directory, Get File, and enable push button

5 views (last 30 days)
Good day,
I am attempting to create a GUI that would allow me to display some subplots based on the directory that GUI user can set and files that GUI user can select. However, this is the first time I am dealing with MatLab GUI and GUIDE and I am pretty lost as to what I should be looking at.
The GUI will have 3 push buttons, 2 of which are disabled. Upon using the first button to set a directory, the second button should be enabled. I am currently figuring out how to enable a push button in code form, and would appreciate any help on this.
The other challenge I am facing now is with regards to setting directory. What I got to understand from reading online solutions is that it can be done using uigetdir and the following code:
directory = uigetdir;
cd(directory);
I managed to change the directory, however, when the directory was changed to another folder that does not contain the .fig file for my GUI, attempting to change the directory again by clicking on the push button would generate an error.
I would greatly appreciate any assistance rendered.
Best Regards
Guan Zhao
06/01/2013

Answers (1)

Jan
Jan on 6 Jan 2013
If you add the folder of your FIG file to the Matlab path, it is found even after you change the current directory. See:
help addpath
doc addpath
pathtool

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!