how to write certain rows in excel using xlswrite

6 次查看(过去 30 天)
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

采纳的回答

live to l e a r n  MATLAB
nothing happened

更多回答(2 个)

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

Image Analyst
Image Analyst 2012-10-5
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.

标签

Community Treasure Hunt

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

Start Hunting!

Translated by