structure to xls file
1 次查看(过去 30 天)
显示 更早的评论
Hi I want to convert structure to xls file. I have a structure like:
my_stat=struct('Models',{{'KS','FK'}},'Mean',{[mean(KS),mean(FK)]})
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);
fclose(fid);
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?
0 个评论
采纳的回答
Jan
2011-11-21
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');
fclose(fid);
type my_results.xls
if mean(KS) and mean(FK) are not scalars, the format string must be adjusted.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Structures 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!