Skip to content

Commit

Permalink
Added the possibility to provide a custom function to stat_summary()
Browse files Browse the repository at this point in the history
  • Loading branch information
piermorel committed Feb 25, 2017
1 parent c0f115b commit 33060ba
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion @gramm/stat_summary.m
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
warning('bin_in in stat_summary() not supported for Matrix/Cell X/Y inputs');
end

if strfind(params.type,'fit')
if ischar(params.type) && ~isempty(strfind(params.type,'fit'))
%If we have a params.type using distributions fits we
%can't vectorize the call to computeci so we do it in a for
%loop
Expand Down Expand Up @@ -346,6 +346,19 @@
return;
end

if isa(type,'function_handle')
try
temp=type(y);
ymean=temp(1,:);
yci=temp(2:3,:);
catch ME
disp(['Error in custom summary computation: ' ME.message ' ...skipping']);
yci=repmat([NaN NaN],size(y,2));
ymean=nan(size(y,2),1);
end
return;
end

try
switch type
case 'bootci'
Expand Down

0 comments on commit 33060ba

Please sign in to comment.