Reading from Multiple files
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
I have my code as listed below reading from 60 files. Is it possible to reduce this coding? Please help.
ex = actxserver('excel.application');
ex.visible = 1;
%---------------------------------------------------
exwb1 = ex.Workbooks.Open('C:\Advisory\1.xls');
exwb2 = ex.Workbooks.Open('C:\Advisory\2.xls');
:
:
exwb60 = ex.Workbooks.Open('C:\Advisory\60.xls');
%---------------------------------------------------
exSheet1=exwb1.Sheets.Item('Compile');
exSheet2=exwb2.Sheets.Item('Compile');
:
:
exSheet60=exwb60.Sheets.Item('Compile');
%---------------------------------------------------
for j=[2:16 21:27]
L=xlsColStr(j);
i=7;
val1 = exSheet1.Range([L,num2str(i)]).get('Value');
val2 = exSheet2.Range([L,num2str(i)]).get('Value');
:
:
val59 = exSheet59.Range([L,num2str(i)]).get('Value');
sum=val1+val2+.......+val59;
exSheet60.Range([L,num2str(i)]).set('Value',sum);
end
0 Commenti
Risposte (1)
Vedere anche
Categorie
Scopri di più su Spreadsheets in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!