MATLAB: Writetable to (.xlsx file) blank output

writetablewritetable output blankxlswritexlswrite blank output

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

Best Answer

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.