필터 지우기
필터 지우기

Multiple Sheets from an excel file

조회 수: 2 (최근 30일)
Hannah_Mad
Hannah_Mad 2020년 4월 20일
답변: Ameer Hamza 2020년 4월 20일
Dear all,
I am currently working on a project where i have data from several subjects in an excel file. Subjects are specified on Sheet 1 of the excel file. However, these subjects were invited every three months, I have 11 sheets of datasets. From each of the dataset I want to analyse one item which is stored under a specific name. To begin with my problem is, that the table 'data' will only contain 73 lines. Why does this happen?
[~,sheets] = xlsfinfo('filename.xlsx')
for s = 1:numel(sheets)
[data] = readtable('filename.xlsx','Sheet',(s))
end
Thank you,
Hannah

채택된 답변

Ameer Hamza
Ameer Hamza 2020년 4월 20일
Variable Data is overwritten in each loop iteration. Use cell array to store all the data
[~,sheets] = xlsfinfo('filename.xlsx')
data = cell(1,numel(sheets))
for s = 1:numel(sheets)
data{s} = readtable('filename.xlsx','Sheet',(s));
end

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Import from MATLAB에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by