efficient way of importing excel sheet

1 visualización (últimos 30 días)
dharmin
dharmin el 8 de Dic. de 2022
Comentada: Rik el 9 de Dic. de 2022
%Hello everyone,
%I am trying to read excel data which contains multiple sheets. Is there any more efficient way of writing this code?
[filename,pathname,~]=uigetfile('*.xlsx','*.xlsx'); %select the excel file
fullname = fullfile(pathname,filename);
sheets = sheetnames(fullname);
[~,~,raw] = xlsread([fullname],sheets(2)); % taking sheets(2) because it contains the main data.
%is there any way to create multiple tables and the number of tables will be equal to the number of sheets.
  1 comentario
Rik
Rik el 9 de Dic. de 2022
I recovered the removed content from the Google cache (something which anyone can do). Editing away your question is very rude. Someone spent time reading your question, understanding your issue, figuring out the solution, and writing an answer. Now you repay that kindness by ensuring that the next person with a similar question can't benefit from this answer.

Iniciar sesión para comentar.

Respuestas (1)

Jonas
Jonas el 8 de Dic. de 2022
Editada: Jonas el 8 de Dic. de 2022
if you activate MultiSelect in uigetfile, you can select more than one file. The resulting variables are then cell arrays with the file/folder names. You can then use a for loop if you like
even more efficient would be using dir() to get the file names etc, then you dont need to klick ;-)

Productos


Versión

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by