Matlab question... xlswrite

Jul 2010
First I'd like to say hello, second, i have a question.

I'm using the xlswrite command in matlab to generate a set of data 36 excel books. Now I need to extract the data back out which I can do with xlsread, however it's the compiling of this data that's becoming tricky.

I'm now trying to compile each sample set into their own compiled sheet of data, since not all 36 samples are from the same set. I've gotten all of the bugs worked out of writing the compiled data to separate work books with the exception of one.

I need xlswrite to write the data from each sample book into the compiled book separated by a column, so it would read left to right sample1->2->3... I can get it to write the sample data in one giant column but it doesn't meet the requirements given to me.

I found a script that will properly change a number into letter to correspond to excel columns (xlscolnum2str), however, when i try to pair this into the xlswrite command, i get a rather nasty error about how it needs to be in A1 format.

the basic code looks like this.
col=xlscolnum2str((ii-1)*2)+1); %data sets are two columns wide.
aa='1'; %row that I want the data written two
bb='2'; %row that I want the data written two
aaa=strcat(col,aa); %etc for all the different data pulled from xlsread

if i put in the variables and execute the last line it returns 'A1', for ii=1, which is stored in a variable aaa, and put into the xlswrite cmd as follows.


and I get the error.

I apologize about the lengthy post, but I wanted to get as much information as I could that was relevant.
Mar 2007
I assume you are currently writing your data in a numeric matrix? If you require your data to be separated by a column, you could prepare all of your data into a cell array and write that to file, giving you much more control of the format I believe.

Write Microsoft Excel spreadsheet file - MATLAB

I haven't tried it, but give the cell array method a shot and see how you get on. Worst case scenario is you can format the data in excel with a few lines of VBA.

Regards Elbarto