フィルターのクリア

How can I use fullfile with cell arrays

18 ビュー (過去 30 日間)
William
William 2013 年 5 月 6 日
コメント済み: Jan Siegmund 2020 年 7 月 5 日
[filename, pathname]=uigetfile('MultiSelect','on','*.dat')
f = fullfile(pathname,filename)
filename =
Columns 1 through 5
[1x60 char] [1x60 char] [1x60 char] [1x60 char] [1x60 char]
Columns 6 through 10
[1x60 char] [1x60 char] [1x60 char] [1x60 char] [1x60 char]
Columns 11 through 12
[1x60 char] [1x60 char]
pathname =
C:\Documents and Settings\
??? Undefined function or method 'eq' for input arguments of type 'cell'.
Error in ==> fullfile at 37 if (f(end)==fs) && (part(1)==fs),
Error in ==> load at 3 f = fullfile(pathname,filename)
I'm trying to get the pathname and filename of a set of dat files from a single directory, and want to use fullfile to connect the names together. But I get the above error. Thank you in advance.

採用された回答

Walter Roberson
Walter Roberson 2013 年 5 月 6 日
f = cellfun(@(S) fullfile(pathname, S), filename, 'Uniform', 0);
  2 件のコメント
John Ettikkalayil
John Ettikkalayil 2013 年 5 月 22 日
編集済み: John Ettikkalayil 2013 年 5 月 22 日
Thanks Walter! This is what I was looking for in order to display full file paths of multiple files users selected.
f = cellfun(@(S) fullfile(pathname, S), filename, 'Uniform', 0);
disp('User Multi-Selected: ')
disp(f(:))
Walter Roberson
Walter Roberson 2013 年 5 月 22 日
If your problem is solved please mark an answer as Accepted.

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

その他の回答 (1 件)

Jan
Jan 2013 年 5 月 6 日
if pathname(end) == filesep
f = strct({pathname}, filename);
else
f = strct({pathname}, {filesep}, filename);
end
  2 件のコメント
William
William 2013 年 5 月 7 日
Sorry I don't really understand what you did here
Jan Siegmund
Jan Siegmund 2020 年 7 月 5 日
strct should be strcat i suppose

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

カテゴリ

Help Center および File ExchangeFile Name Construction についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by