How to import a mass of excel documents into a table
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
I'm trying to import a very large number of excel files from one folder into a table with each excel file being a column and each piece of data (which would be pulled from column B in Excel) as the rows. The code must also be flexible enough to add more Excel files into the folder adding the new data to the table without any errors. This is the code I have so far, but I'm struggling to output any type of table from this.
myfolderinfo = dir('.xlsx');
N = size(myfolderinfo);
n = N(1,1);
pt_txt = cell(302,n);
for i = 1:n
[num,txt,raw] = xlsread(myfolderinfo(i).name);
pt_txt (:,i) = txt(:,2);
end
for i = 1:n
[num,txt,raw] = xlsread(myfolderinfo(i).name);
pt_txt1 (:,i) = txt(:,1);
end
Any help would be appreciated, thanks
0 Kommentare
Antworten (1)
Akhilesh Thakur
am 2 Aug. 2017
https://www.mathworks.com/matlabcentral/newsreader/view_thread/323999 http://www.mathworks.com/help/releases/R2010b/techdoc/ref/xlsread.html Are you using xlsread and using it in a loop to open multiple files? If yes use actxserver before your loop execution so your excel file is kept open. Then close the files after processing. I hope this helps. let me know more questions.
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!