Filter löschen
Filter löschen

Saving Path from uigetdir & showing files in uigetdir explorer.

5 Ansichten (letzte 30 Tage)
Adam Conover
Adam Conover am 21 Jul. 2017
Beantwortet: Kambren Rowlan am 21 Jul. 2017
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.

Antworten (1)

Kambren Rowlan
Kambren Rowlan am 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

Kategorien

Mehr zu Migrate GUIDE Apps finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by