How to write a continuosly extending matrix ( sample1=[3 2 3 4 1 2;sample] ) to an excel sheet cell by cell?
1 view (last 30 days)
Show older comments
The incoming data from serial connection writes the values in the sample matrix (sample values) changing each second, as:
semval = []
semval = [semval; sample1, sample2, sample3, sample4, sample5, sample6, sample7, sample8];
i want to export this data continuously to an excel sheet with each matrix element in different cells in the excel, i tried dlmwrite and csvwrite commands, but they output all line in just one cell. Outputing cell by cell is possible?
0 Comments
Answers (4)
Image Analyst
on 11 Feb 2012
Your first line initializing semval to null is unnecessary. This code works fine.
sample1 = 100;
sample2 = 200;
sample3 = 300;
sample4 = 400;
sample5 = 500;
sample6 = 600;
sample7 = 700;
sample8 = 800;
semval = [sample1, sample2, sample3, sample4, sample5, sample6, sample7, sample8]
csvwrite('test.csv', semval);
Each number is in one cell of Excel. I'm not sure what you did to mess it up. Alternatively, did you try xlswrite()?
If you want to write one cell at a time, like in a for loop, then you'll have to use ActiveX, because csvwrite, dlmwrite, and xlswrite all just write out the entire set of data in one batch operation, not cell by cell. See my posts here in Answers where I gave ActiveX demo code.
See Also
Categories
Find more on Spreadsheets in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!