Export to Excel results from a function with a nested array
1 次查看(过去 30 天)
显示 更早的评论
Dear all,
I'm exporting to excel the results of a function that contain some statistics.
2 of the results are themselves arrays.
This suppose a problem, since those results are not exported to my excel file.
This is the cell array to be exported:
'mean' 1.78016727419355
'sem' 0.0934817511799512
'numel' 186
'gname' '1'
'std' 1.27492110794460
'var' 1.62542383148268
'min' 0
'max' 4.71372000000000
'range' 4.71372000000000
'meanci' [1.59573993677146,1.96459461161564]
'predci' [-0.741838634100196,4.30217318248729]
And this is what is actually exported:
mean 1.780167274
sem 0.093481751
numel 186
gname 1
std 1.274921108
var 1.625423831
min 0
max 4.71372
range 4.71372
meanci
predci
This is the function I'm using for these purposes:
function [Y]=descriptiveStats( X )
M={};
N=[];
M={'mean','sem','numel','gname','std','var','min','max','range','meanci','predci'}.';
[mean,sem,numel,gname,std,var,min,max,range,meanci,predci]=grpstats(X,[],{'mean','sem','numel','gname','std','var','min','max','range','meanci','predci'});
N=[mean,sem,numel,gname,std,var,min,max,range,meanci,predci].';
Y=[M,N];
xlswrite('df.xlsx',Y)
end
How can I handle this in order to export the complete set of results to Excel?
Thanks in advance,
Diego
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Spreadsheets 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!