How to import a mass of excel documents into a table

1 visualización (últimos 30 días)
N Reichen
N Reichen el 2 de Ag. de 2017
Comentada: N Reichen el 3 de Ag. de 2017
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

Respuestas (1)

Akhilesh Thakur
Akhilesh Thakur el 2 de Ag. de 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.
  1 comentario
N Reichen
N Reichen el 3 de Ag. de 2017
My MatLAB skills are very sparse, so I'm not sure how to use actxserver

Iniciar sesión para comentar.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by