How to write string and numerical data to an excel file.

Dear Sir/Madam,
I have a issue of saving mixed data to an excel file. The following is my code:
Title = {'CameraSN' 'BenchTime' 'GrayLevel' 'Mean' 'MAX' 'MIN' 'Particles' 'DetectTime'};
Output = [Title; CamFolder, BenchID, num2cell(G), num2cell(M), num2cell(MAX), num2cell(MIN), num2cell(N), num2cell(Time)];
xlswrite(strcat(OutFilePath,OutputFileName), Output);
Notes:
  1. "CameraSN" and "BenchID" are cell arrays
  2. The length of each element of each cell in these cell arrays is 8 and 32 respectively.
The code works fine, all data are saved expect the colum of "BenchID" is empty. However, if using "xlswrite('test9.xls', BenchID{1})", the data can be saved properly.
Could you help me figure out what happened when I saved all data at the same time into a spreadsheet?
Best regards, Tracy

Answers (1)

In addtion, xlswrite('test9.xls', BenchID)" saves empty column(even cell data are in BenchID), while xlswrite('test9.xls', CamFolder)" saves the real data in CamFolder cell array.

Asked:

on 21 Feb 2013

Community Treasure Hunt

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

Start Hunting!