Saving Path from uigetdir & showing files in uigetdir explorer.
4 views (last 30 days)
Show older comments
I have a popup menu with three cases; A, B, C. The cases set a file path for the function. A & B are hardcoded, but C uses UIGETDIR to allow the user to set their own file path.
1) UIGETDIR only shows folders, is it possible to display files in the explorer?
2) Upon selecting a file path using UIGETDIR, I'd like the user to have to option to save that file path for future use and have it displayed in the popup menu. - User selects filepath - "Would you like to save this filepath?" - No -> continue on - Yes -> "Set Name" -> filepath under "Name" is saved to popup menu.
Don't know if 2) is possible, but any help would be great.
0 Comments
Answers (1)
Kambren Rowlan
on 21 Jul 2017
I think this may help with your 2nd question. Saves the pathname as a workspace variable, then loads it in on request, might not be the most elegant solution but I think it's capable of getting done what you're trying if you adapt it.
user_input = input('Which default path: ');
switch user_input
case 1
%input 1 to use saved path
load userPath.mat;
startingPoint = PathName;
case 2
%hardcoded
startingPoint = '';
case 3
%hardcded
startingPoint = '';
otherwise
error('invalid input')
end
[PathName] = uigetdir(startingPoint,'Select a Directory');
user_input2 = input('Would you like to save your selection: ');
%input 1 to save path
if user_input2 == 1
save('userPath.mat','PathName');
end
0 Comments
See Also
Categories
Find more on Migrate GUIDE Apps in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!