Create table from excel spreadsheet with multiple sheets

조회 수: 8 (최근 30일)
alpedhuez
alpedhuez 2018년 7월 7일
댓글: dpb 2018년 7월 7일
Suppose I have xlsx file with multiple sheets. I want to create table A from the first sheet and create table B from the second sheet. Please advise.

채택된 답변

Image Analyst
Image Analyst 2018년 7월 7일
Try this:
folder = fileparts(which('patients.xls')) % Determine where demo folder is.
fullFileName = fullfile(folder, 'patients.xls');
[status, sheetNames] = xlsfinfo(fullFileName)
numSheets = length(sheetNames)
t1 = readtable(fullFileName, 'Sheet', 1)
t2 = readtable(fullFileName, 'Sheet', 2)
and so on. Put in a loop if you want.
  댓글 수: 2
alpedhuez
alpedhuez 2018년 7월 7일
What will the first four lines do?
dpb
dpb 2018년 7월 7일
Try it and see???

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

추가 답변 (1개)

dpb
dpb 2018년 7월 7일
See
doc readtable
  댓글 수: 2
alpedhuez
alpedhuez 2018년 7월 7일
편집: alpedhuez 2018년 7월 7일
Is it like
readtable('patients.xls',...
'Sheet',1,...)
?
dpb
dpb 2018년 7월 7일
That's certainly possible, yes...you're missing a LHS variable to assign the result to, however.

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

카테고리

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