Read and process multiple sheets from Excel to Matlab
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Francesca Danielli
el 21 de Dic. de 2021
Hi!
I have an Excel file with N sheets.
Each sheet contains two coloumns (x and y coordinates of a curve).
I want to read them in Matlab at once, save data and plot them.
Any suggestion?
Thank you
2 comentarios
Mitchell Thurston
el 21 de Dic. de 2021
the second argument in xlsread is the sheet number, https://www.mathworks.com/help/matlab/ref/xlsread.html#bthgbma
you can either iterate through the sheet numbers in a loop, or just define the sheets you want to read. As far as I know, there isn't an automatically "read all of the sheets". hope this helps
Respuesta aceptada
Stephen23
el 21 de Dic. de 2021
Editada: Stephen23
el 21 de Dic. de 2021
Untested, but this should get you started:
P = 'absolute or relative path to where the files are saved';
F = 'filename.xlsx';
S = sheetnames(fullfile(P,F));
N = numel(S);
C = cell(1,N);
for k = 1:N
C{k} = readtable(fullfile(P,F), 'Sheet',S(k));
end
0 comentarios
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!