uigetfile関​数でファイルを選択す​る時に、前回選択した​ファイルのディレクト​リを表示させる方法を​教えてください。

조회 수: 12 (최근 30일)
MathWorks Support Team
MathWorks Support Team 2009년 6월 29일
편집: MathWorks Support Team 2025년 2월 20일
uigetfile関数でファイルを選択する時に、前回選択したファイルのディレクトリを表示させる方法を教えてください。

채택된 답변

MathWorks Support Team
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개)

카테고리

Help CenterFile Exchange에서 変数에 대해 자세히 알아보기

제품


릴리스

R2017a

Community Treasure Hunt

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

Start Hunting!