How to get the pathname and filename of some files that I have chosen?

9 ビュー (過去 30 日間)
Alvindra Pratama
Alvindra Pratama 2016 年 5 月 3 日
コメント済み: Alvindra Pratama 2016 年 5 月 6 日
I've managed to select multiple files through a GUI matlab, but I just get the pathname and filename of the last file alone, for example I choose the file 1,2,3, and 4, but I get only a pathname and filename of the file 4 only, whereas I want get the whole pathname and filename of the file that I choose. how can I do that and display it into a Edit Text GUI components?

採用された回答

CS Researcher
CS Researcher 2016 年 5 月 3 日
編集済み: CS Researcher 2016 年 5 月 3 日
You can do this:
[filename, pathname] = uigetfile(type, 'Select Multiple Files','MultiSelect','on');
numberOfFiles = length(filename);
selectedFiles = cell(1,numberOfFiles);
for i = 1:numberOfFiles
selectedFiles{1,i} = fullfile(pathname, filesep, filename{1,i});
end
This will however not work if you select a single file. Hope this helps!
  3 件のコメント
CS Researcher
CS Researcher 2016 年 5 月 3 日
  1. Right click on the edit box
  2. Get the Tag (lets say it is TagName)
  3. Go to your code and use this:
set(handles.TagName, 'String', nameOfTheFile);
Alvindra Pratama
Alvindra Pratama 2016 年 5 月 6 日
Thank you so much, this is really help me

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeString Parsing についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by