Can I "export", "write" or "save" a table to eg Excel ?

1 view (last 30 days)
I want to write my table variable in eg .TXT file of a .XLSX . Can I do that ?

Answers (2)

Azzi Abdelmalek
Azzi Abdelmalek on 29 Sep 2013
Use xlswrite
doc xlswrite
oc xlsread
  2 Comments
Michaël
Michaël on 29 Sep 2013
I've tried that ...
>> C = table(A,B)
C =
A B
_ _
1 4
2 5
3 6
>> xlswrite('test.xls',C) Error using xlswrite (line 166) Input data must be a numeric, cell, or logical array.
Azzi Abdelmalek
Azzi Abdelmalek on 29 Sep 2013
C={'A' 'B';1 4;2 5;3 6}
xlswrite('test.xls',C)

Sign in to comment.


Image Analyst
Image Analyst on 29 Sep 2013
You can use fprintf() if you want to write out a simple text file. See the help for an example. You can use xlswrite() as long as you aren't going to do it over and over again in a loop, which would be very slow. In that case use ActiveX (let me know if you want a demo).
  2 Comments
Michaël
Michaël on 29 Sep 2013
I would like a demo, because with a TABLE-variable it doesn't work without conversion to eg. a dataset-variable or a cell-array

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!