Create table from excel spreadsheet with multiple sheets

8 visualizaciones (últimos 30 días)
alpedhuez
alpedhuez el 7 de Jul. de 2018
Comentada: dpb el 7 de Jul. de 2018
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.

Respuesta aceptada

Image Analyst
Image Analyst el 7 de Jul. de 2018
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 comentarios
alpedhuez
alpedhuez el 7 de Jul. de 2018
What will the first four lines do?
dpb
dpb el 7 de Jul. de 2018
Try it and see???

Iniciar sesión para comentar.

Más respuestas (1)

dpb
dpb el 7 de Jul. de 2018
See
doc readtable
  2 comentarios
alpedhuez
alpedhuez el 7 de Jul. de 2018
Editada: alpedhuez el 7 de Jul. de 2018
Is it like
readtable('patients.xls',...
'Sheet',1,...)
?
dpb
dpb el 7 de Jul. de 2018
That's certainly possible, yes...you're missing a LHS variable to assign the result to, however.

Iniciar sesión para comentar.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by