export cell2table to excel

9 views (last 30 days)
ramez sabra
ramez sabra on 17 May 2019
Edited: ramez sabra on 28 May 2019
Hi, how do I export contents of a cell2table to an excel sheet? do i need to convert to a table first before i can export to excel??
I get the following error statement with my code below. (line 177 is the writable line in the code below)
Undefined function 'write' for input arguments of type 'cell'.
Error in writetable (line 124)
write(a,filename,varargin{:})
Error in data_summary_dat (line 177)
writetable(Summary, filename)
Summary{i,:} = cell2table(data, 'VariableNames', columNames);
xlswrite(filename, Summary)
winopen(filename)

Answers (1)

Peter Perkins
Peter Perkins on 20 May 2019
cell2table is a unction that converts a cell array to 1 table. writetable is a function that writes a table to a file.
This
Summary{i,:} = cell2table(...
suggests that you are (maybe???) creating a table by converting a 1-row cell array and assigning to a row of a table? Maybe? There have to be better ways to do whatever it is that you are doing. A short complete simple example would perhaps make it more clear.
  1 Comment
ramez sabra
ramez sabra on 22 May 2019
thank you for the follow up.
basically i have a set of files, the set "data" extracts parameters from every file (file name, average of a signal, etc.).
Summary is my table, it takes the inofrmation in every iterration of data and stores it in a table row.
finally i do writetable to export "Summary" to excel.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!