Reputation: 29064
I have a structure which I want to write to excel file.
For example, I want to write A which is structure to excel. A contains both textdata and numbers which I want to write to excel.
>> A.textdata
ans =
Sheet1: {'Coco-Cola' 'CCE'}
>> A.data
ans =
Sheet1: [4 46.7100 46.2800 185.1200 -0.0092 -1.7200]
The output should be like this:
Need some guidance on how to do it.
What I have tried so far:
1) xlswrite(filename,A);
It gave me this error: Error using xlswrite (line 166) Input data must be a numeric, cell, or logical array.
2) Acell = struct2cell(A);xlswrite(filename,Acell);
It gave me this error:An error occurred on data export in CSV format. Caused by: Undefined function 'real' for input arguments of type 'struct'.
Upvotes: 0
Views: 5859
Reputation: 1391
please try the following:
writetable(struct2table(A), 'parameters.xlsx');
Here, A is a structure
Upvotes: 1