I am trying to write data on to Excel on a specific but dynamic location (say not E1 or C3 but depending on what I have done in the code, row no. 2*i and column 4*y). Is it possible to do that?

1 次查看(过去 30 天)
I am trying to write data on to Excel on a specific but dynamic location (say not E1 or C3 but depending on what I have done in the code, row no. 2*i and column 4*y). Is it possible to do that?

回答(1 个)

Caglar
Caglar 2018-12-20
编辑:Caglar 2018-12-20
You need to convert your row and column into cell name that xlswrite understands.
cellname=[xlscol(column) num2str(row)];
Note that xlswrite starts to write from that cell, but does not limit writing to that cell. If you feed it with an array or matrix, it will write on neigbour cells too.
An unexpected behaviour (at least to me) is that it writes one letter per cell when writing a char array or string. Therefore, use cellstr(yourtext) when writing those.

Community Treasure Hunt

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

Start Hunting!

Translated by