writetable to (.xlsx file) blank output

8 views (last 30 days)
I have a Table compose of string names (about 130+ names). Only 1 column.
BUT my excel file is Blank. no errors or warnings. just the output is BLANK.
please, can someone explain.
data=table;
f=fieldnames(data);
for k=1:size(f,1)
xlswrite('name.xlsx',data.(f{k}),f{k})
end
%also tried this code: writetable(table,'name.xls','Sheet',2)
Capture.PNG

Accepted Answer

Alex Mcaulley
Alex Mcaulley on 28 Feb 2019
Apparently writetable(table,'name.xls','Sheet',2) should work.
I think the problem is the name of the variable, table is a matlab function that gives an empty table. Try changing the name of the variable.
  8 Comments
Adel Monette Rivera
Adel Monette Rivera on 1 Mar 2019
WOW!!!~ it work like magic :D
thanks.
now, can i really put cell arrays inside a cell array?
Alex Mcaulley
Alex Mcaulley on 1 Mar 2019
For sure:
A = cell(1,1);
A{1} = cell(1, 5);

Sign in to comment.

More Answers (0)

Categories

Find more on Tables 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!