efficient way of importing excel sheet
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
%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 Kommentar
Rik
am 9 Dez. 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.
Antworten (1)
Jonas
am 8 Dez. 2022
Bearbeitet: Jonas
am 8 Dez. 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 ;-)
0 Kommentare
Siehe auch
Kategorien
Mehr zu Spreadsheets finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!