How to write data from matlab to excel horizontally?

6 views (last 30 days)
Dear all,
Please any advice on this is much appreciated.
If i use this command:
xlswrite('xxxtrice.xlsx', output, 'Sheet1', 'G2');
Then the data in excel will show like this: G2, G3, G4 etc
However I would like the data to appear in excel like this: G2, H2, I2
The size of output changes all the times so I cannot specify the range of G2 easily.
Any help is welcome
Regards
S

Accepted Answer

Joseph Cheng
Joseph Cheng on 28 Jul 2014
What you would need to to is make the output a 1x3 array. i'm assuming that the output is a 3 row and 1 column array?
if i did a test like this
x = randi(10,1,10);
xlswrite('book1.xls',x,'sheet1','G10')
i get it across the columns
if i do
x = randi(10,10,1);
xlswrite('book1.xls',x,'sheet1','G10')
i get it just down column G.

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!