How to loop string files with the help of xlswrite to write on new areas of same sheet an excel file
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
navan
am 26 Jun. 2015
Kommentiert: navan
am 26 Jun. 2015
I would like to write my matlab workspace file 'frequencycurve' to an excel file 'frequency.xlsx'. I want to loop my program each time so that it writes my 'frequencycurve' to new aera of the same sheet of excel file.
I want to write first loop data into A1:C5 then A2:C6 till A10:C15 of the excel file.
I use following code but is not working. Kindly help.
filename = 'frequency.xlsx';
for i=1:10
for j=5:15
range='A(i):C(j)';
xlswrite(filename,frequencycurve,range)
end
end
I want to write first loop data into A1:C5 then A2:C6 till A10:C15 of the excel file.
0 Kommentare
Akzeptierte Antwort
Azzi Abdelmalek
am 26 Jun. 2015
Bearbeitet: Azzi Abdelmalek
am 26 Jun. 2015
ii=2,
jj=3,
range=sprintf('A%d:C%d',ii,jj)
Weitere Antworten (1)
Image Analyst
am 26 Jun. 2015
Each call to xlswrite() launches Excel, opens the workbook, transfers the data, saves the workbook, and shuts down Excel. You'd be launching Excel 110 times, and shutting down Excel 110 times. This will take a very long time. You should learn how to make up an array to call xlswrite() just one time AFTER the loop.
Or else use ActiveX (if you're using Windows) so that you just open Excel once and shutdown Excel once, with 110 pokes of data (which will be instantaneous). I've attached a demo of using ActiveX to control Excel.
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!