Saving Path from uigetdir & showing files in uigetdir explorer.
2 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (1 件)
Kambren Rowlan
2017 年 7 月 21 日
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 件のコメント
参考
カテゴリ
Help Center および File Exchange で Migrate GUIDE Apps についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!