Is it possible to increment the column range in a for loop before writing in excel?

5 views (last 30 days)
I guess it's easy with Matlab but I couldn't find any solution. Basically I have 67 files in excel, in each of them I have 1 column of numbers I want to copy in a single excel file i.e.:
file01.xls A1:A10 -----> copied in fileX.xls A1:A10
file02.xls A1:A10 -----> copied in fileX.xls B1:B10
file03.xls A1:A10 -----> copied in fileX.xls C1:C10
file03.xls A1:A10 -----> copied in fileX.xls D1:D10
I'm creating a for loop to read from xls files and write in fileX.xls but I don't know how to increment the letters of the range of fileX.xls
Any help?
Stefano

Accepted Answer

Image Analyst
Image Analyst on 17 Apr 2015
Yes, but unless you're willing to wait a very long time, you should not use xlswrite. You should use ActiveX, like in my attached demo.
And you might want to use a utility that converts the column number to the Excel column letter: http://www.mathworks.com/matlabcentral/fileexchange/15748-excel-column-number-to-column-name

More Answers (1)

Stefano
Stefano on 17 Apr 2015
Thanks a lot, it was exactly what a was looking for! Stefano

Community Treasure Hunt

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

Start Hunting!