필터 지우기
필터 지우기

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 CenterFile Exchange에서 File Name Construction에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by