필터 지우기
필터 지우기

How to read multiple excel files with pattern in their names

조회 수: 1 (최근 30일)
DONGUK KIM
DONGUK KIM 2019년 11월 3일
답변: Image Analyst 2019년 11월 3일
As the title says, I want to read multiple excel files that have a pattern in their names.
The file names start from 1000 to 100000, increasing with an interval of 1000.
Thanks in advance.

답변 (2개)

Bhaskar R
Bhaskar R 2019년 11월 3일
% assuming working in the present working directory
files = 1000:1000:100000;
file_data = cell(1, length(files));
for iFile = 1:length(files)
% in string concatamatiom
% 1 - if filename has any pre string
% 2 - for loop varibale from 1000:1000:100000
% 3 - file extension
str = ['file_pre_string_if_any_', num2str(iFile), '.xlsx'];
file_data{iFile} = xlsread(str); % excel data will be stored in the variable file_data
end
  댓글 수: 1
DONGUK KIM
DONGUK KIM 2019년 11월 3일
What if the directory is in another folder? Also is it possible to read them as matrices?

댓글을 달려면 로그인하십시오.


Image Analyst
Image Analyst 2019년 11월 3일
Use the first code chunk for this topic in the FAQ

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by