Issue defining new starting cell for xlswrite outputs

1 view (last 30 days)
In each iteration, I want the values of my matrix to be added to an excel spreadsheet, without overriding the previous results on that same sheet. Here's how I've coded it (mpciter and mcCounter are variables that seem to be working fine):
if mpciter == 29
str = strcat('A',num2str(1+31*(mcCounter - 1)));
str2 = strcat(str,':',str);
xlswrite('myFile.xls',myResults,str2);
end
The spreadsheet gets created (I've tested with different names) and I can even have my code dynamically create a new spreadsheet for each iteration. However, it always wants to just start the output print at A1. I tried defining the sheet, hardcoding a new cell different than A1, etc, following the syntaxes for xlswrite, but I still get the data overriden each time this function is called, and always at A1.
Any thoughts on what may be happening here?
Thanks!
  1 Comment
dpb
dpb on 2 Mar 2014
Yep, working as design. xlswrite doesn't have the facility to add to a sheet (even though that seem like an obvious desirable extension).
Choices are--
a) build the full array in memory and write it at the end, or
b) use DDE/COM to interface directly w/ Excel

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!