Import data with several sheets

조회 수: 10 (최근 30일)
Victoria Pake
Victoria Pake 2021년 1월 2일
댓글: Mathieu NOE 2021년 1월 4일
Dear All,
I have a 2464x2464 matrix for 14 years saved in an excel file. Each working sheet represent one year including the same matrix, such that the data points change over time. I do not have specific time variables included, just the data. How i can import the whole matrix and make Matlab understand it such that i can use the matrix and calculate the development of the rows over time without creating 14 datasets?
Thanks in Advance

채택된 답변

Mathieu NOE
Mathieu NOE 2021년 1월 2일
hello Victoria
happy new year first !
this little piece of code will import evry sheet and stack the data , I assumed you want to have them stacked vertically
it assumes the number of columns are the same in every sheet
% Importing Data from excel across multiple sheets and filenames.
filename = 'file.xlsx';
[~,sheet_name]=xlsfinfo(filename)
data_all = [];
for k=1:numel(sheet_name)
[data,TXT,RAW]=xlsread(filename,sheet_name{k})
% stack data vertically
data_all = [data_all ; data];
end
  댓글 수: 4
Victoria Pake
Victoria Pake 2021년 1월 4일
Thanks Mathieu,
it worked.
All the best for you. :)
Mathieu NOE
Mathieu NOE 2021년 1월 4일
You're welcome !!

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

추가 답변 (0개)

카테고리

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