how to write certain rows in excel using xlswrite

5 views (last 30 days)
This is my values A:1 4 2 5 3 6 8 7 9 10 1 2 11 13 14 15 and
for i=1:1:16
xlswrite('filename.xlsx',A)
end
and here my excel sheet having one values only:15
but am needed 1 4 2 5 3 6 8 7 9 10 1 2 11 13 14 15

Accepted Answer

live to l e a r n  MATLAB
live to l e a r n MATLAB on 5 Oct 2012
nothing happened

More Answers (2)

Muruganandham Subramanian
Hi kesavan,
Insteadof writing it as 'filename.xlsx' .try it as 'filename.xls'

Image Analyst
Image Analyst on 5 Oct 2012
Does that mean your question is figured out? I mean, you just wrote the same array of 15 numbers out to the same workbook/worksheet 16 times in a row, so what were you expecting?
Or maybe A is just a scalar, not an array and you wanted each element in a different row. Like this:
for k = 1 : 16
cellReference = sprintf('A%d', k);
xlswrite('filename.xlsx', A(k), cellReference)
end
But you don't want to use xlswrite that many times unless you're willing to have it be very slow because it has to launch and shutdown Excel every iteration in your loop. You'd want to use xlswrite1 (File Exchange) and ActiveX programming.

Tags

Community Treasure Hunt

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

Start Hunting!