xlswrite cell array of strings to vertical array in Excel - goes wrong
2 views (last 30 days)
Show older comments
Hi,
I have a series of timestamps that I want to write to Excel in the following way:
xlswrite(['mpSim_results_' fname(1:end-4) '.xlsx'], outputTimes(1:10), 'Sheet1','A2:A11');
And instead of writing 10 different values to A2:A11, the value outputTimes(1) gets written 10 times to the column A2:A11. When I change this to 'A2:J2' this works fine!
When I transpose the input, it still does not work, i.e. using outputTimes(1:10)' or outputTimes(1:10).' to write to A2:A11.
Why isn't this working? Using Matlab R2012b.
Kind regards, Lennart
0 Comments
Answers (1)
A Jenkins
on 4 Sep 2013
Try just 'A2' for range, not 'A2:A11'.
xlswrite(['mpSim_results_' fname(1:end-4) '.xlsx'], outputTimes(1:10), 'Sheet1','A2');
from the documentation for xlswrite:
"If you specify sheet, then xlRange can specify only the first cell (such as 'D2')."
See Also
Categories
Find more on Spreadsheets in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!