필터 지우기
필터 지우기

Search down 2 subdirectories from a starting directory and read a certain cell from the csv file?

조회 수: 2 (최근 30일)
Hello. I have about a directory C:\images\temp that has inside 100 sub directories named by a date.
Inside these date named subdirectories, there are 2 directories deep (who's names can vary) and residing in there is a csv file I want to open. I thought I could use wildcards for the 2 additional directories but apparently not
pathStart='C:\images\temp'
list_dir = dir(pathStart)
list_dir.name
list_files = '';
for i = 1:length(list_dir)
cur_files = dir([pathStart list_dir(i).name '/*.csv'])
list_files = [list_files,fullfile(list_dir(i).name,{cur_files.name})];
end
Is it possible to search down 2 subdirectories from a starting directory and read a certain cell from the csv file?

채택된 답변

Jan
Jan 2018년 6월 28일
편집: Jan 2018년 6월 28일
pathStart = 'C:\images\temp';
list_dir = dir(fullfile(pathStart, '**', '*.csv')); % Working since R2016b
for i = 1:length(list_dir)
cur_files = fullfile(list_dir(i).folder, list_dir(i).name)
end

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 File Operations에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by