0
디렉토리의 파일 이름에만 액세스하는 방법은 무엇입니까?MATLAB을 사용하여 디렉토리의 파일 이름을 반복적으로 처리
>> files = dir('*.png');
>> disp(class(dir('*.png')))
struct
>> fields
fields =
'name'
'date'
'bytes'
'isdir'
'datenum'
>> for i=1:numel(fields)
files.(fields{i}.name)
end
Struct contents reference from a non-struct array object.
>> for i=1:numel(fields)
files.(fields{i}).name
end
Expected one output from a curly brace or dot indexing expression, but there were 11 results.
for 루프에 대한 대안은 '이름 = {files.name}를 사용하여 셀 어레이에 바로 추출하는 것입니다 각 파일 이름을 반복합니다. – Adrian