Create table from excel spreadsheet with multiple sheets

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 日

2 投票

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 日

0 投票

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.

サインインしてコメントする。

製品

タグ

質問済み:

2018 年 7 月 7 日

コメント済み:

dpb
2018 年 7 月 7 日

Community Treasure Hunt

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

Start Hunting!

Translated by