Reading excel file sheets

2 visualizaciones (últimos 30 días)
NETHRAVATHI S
NETHRAVATHI S el 19 de Mzo. de 2021
Comentada: laurent jalabert el 4 de Feb. de 2022
How to read sheets of an excel file and save it. also I want to access these sheets inside a for loop for further analysis and plottig.
I have done like this.
filename = 'timeframe_wodsm.xls';
VHC = xlsread(filename,1);
HC = xlsread(filename,2);
MC = xlsread(filename,3);
LC = xlsread(filename,4);
Here I am getting 4 different files for each sheets,
For further analysis, logic is the same but i have to repeat it for 4 times. How to keep it in a loop?
Also how to plot 4 graphs for each of the sheets inside the loop itself?
  1 comentario
laurent jalabert
laurent jalabert el 4 de Feb. de 2022
d = uigetdir(pwd, 'Select a folder');
DATA = dir(fullfile(d, '*.xlsx'));
[status,sheets] = xlsfinfo(DATA.name);
sheets = sheetnames(DATA.name);
for ii=1:length(sheets)
EachSheet{ii} = readtable(DATA.name,'Sheet',ii);
end

Iniciar sesión para comentar.

Respuesta aceptada

KSSV
KSSV el 19 de Mzo. de 2021
Editada: KSSV el 19 de Mzo. de 2021
It is suggested to use readtable instead.
filename = 'timeframe_wodsm.xls';
data = = cell(4,1) ;
for i = 1:4
data{i} = xlsread(filename,i);
end
  1 comentario
NETHRAVATHI S
NETHRAVATHI S el 19 de Mzo. de 2021
Thank you for your answer.
It helped.

Iniciar sesión para comentar.

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by