uigetfile関数でファイルを選択する時に、前回選択したファイルのディレクトリを表示させる方法を教えてください。
12 ビュー (過去 30 日間)
古いコメントを表示
MathWorks Support Team
2009 年 6 月 29 日
編集済み: MathWorks Support Team
2025 年 2 月 20 日
uigetfile関数でファイルを選択する時に、前回選択したファイルのディレクトリを表示させる方法を教えてください。
採用された回答
MathWorks Support Team
2025 年 2 月 20 日
編集済み: MathWorks Support Team
2025 年 2 月 20 日
persistent関数を使い、前回選択したファイルのパスを保持しておくことで可能です。
下記にプログラム例を示します。
function testUigetfile
persistent PathName %選択したファイルのパス保持
if isempty(PathName)
[FileName, PathName] = uigetfile('*.m', 'Select the MATLAB file');
else
[FileName, PathName] = uigetfile(fullfile(PathName, '*.m'), 'Select the MATLAB file');
end
end
詳細は、MATLABヘルプドキュメントをご参照ください。
>> doc persistent
0 件のコメント
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!