How to create multiple tables from a single spreadsheet
10 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Federico Migliosi
el 17 de Nov. de 2021
Comentada: Dave B
el 17 de Nov. de 2021
I have a single .xlsx spreadsheet with multple tables on the same page, but one below the other.
The picture below shows an example.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/803744/image.png)
From this spreadsheet I want to create two different tables at the same time. I have tried using the import tool or the readtable() function but I did not succeed.
Can someone help me?
0 comentarios
Respuesta aceptada
Dave B
el 17 de Nov. de 2021
For example:
T = readtable('patients.xls',...
'Range','C2:E6',...
'ReadVariableNames',false)
If you attach your excel file we can help with it, but it's really as easy as specifying the excel column and row for the upper left and lower right corners.
2 comentarios
Dave B
el 17 de Nov. de 2021
Sadly, I don't think there's any way to create multiple tables with one call to readtable.
If you really wanted to you could write a little function that looped over a set of ranges to return multiple tables (just to make it easier to read), but you'd be faced with choosing whether the output should be a cell array of tables (?) or if you'd vary the number of output arguments based on the number of ranges. Both would be a little awkward IMO.
Más respuestas (0)
Ver también
Categorías
Más información sobre Spreadsheets en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!