Writing from MATLAB to Excel with ActiveX
I was wondering if there was a way of using the Cell function rather than Range with MATLAB's ActiveX commands? Perhaps someone has a solution to my p开发者_Python百科roblem. I have many lists of data and all of varying sizes, for example:
List 1 has 10
List 2 has 13
List 3 has 3
...
I would like to take that data and export it to a new sheet in Excel from MATLAB. I can do it with the Range function but this is way too long. If I had the Cell function I would be able to look up the length of List x
and tell it to loop over the length of the list and move down one cell.
If anyone has another solution I would appreciate the answer.
Thanks in advanceNever mind I found the solution. If anyone else is looking for something along these lines this is what I did:
i = 10; %# in place of the loop index
CellNumber = mat2str(i); %# convert it to string so that we can append cell letter and cell number
Cell = ['A', CellNumber]; %# append cell number to cell letter to get cell location in excel form
range1 = get(sheet1, 'Range', Cell); %# select specified location
range1.Value = File{i} %# set that location to what you want
精彩评论