how to write certain rows in excel using xlswrite

3 visualizaciones (últimos 30 días)
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

Respuesta aceptada

live to l e a r n  MATLAB
live to l e a r n MATLAB el 5 de Oct. de 2012
nothing happened

Más respuestas (2)

Muruganandham Subramanian
Muruganandham Subramanian el 5 de Oct. de 2012
Hi kesavan,
Insteadof writing it as 'filename.xlsx' .try it as 'filename.xls'

Image Analyst
Image Analyst el 5 de Oct. de 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.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by