Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

structure to xls file

Asked by Meh on 21 Nov 2011

Hi I want to convert structure to xls file. I have a structure like:


I want to write this structure in an excel file. I come up with this one:

fid = fopen('my_results.xls','W');
fprintf(fid, '%f\n', my_stat);
type my_results.xls

But my program gives me error message

??? Error using ==> sprintf
Function is not defined for 'struct' inputs.

How shall I proceed?




No products are associated with this question.

1 Answer

Answer by Jan Simon on 21 Nov 2011
Accepted answer
fid = fopen('my_results.xls', 'w');
fprintf(fid, '%s\t', my_stat.Models{:});
fprintf(fid, '\n');
fprintf(fid, '%f\t%f\t', my_stat.Mean);
fprintf(fid, '\n');
type my_results.xls

if mean(KS) and mean(FK) are not scalars, the format string must be adjusted.


Meh on 21 Nov 2011

Perfect!!!!!!!!!! Thanks Jan!!! Only the excel file does not open afterwards. even if i try it manualy!

Meh on 21 Nov 2011

Problem Solved!. I forgot to delete previous excel file and run again. Now fine.

Jan Simon

Contact us