Skip to content
Snippets Groups Projects
Commit 233412b9 authored by William Lövfors's avatar William Lövfors
Browse files

Merge branch 'master' of gitlab.liu.se:willo18/matlab_general

parents 854864db 49d0e816
No related branches found
No related tags found
No related merge requests found
No preview for this file type
function [ SEM ] = nanSEM(x, dim,e)
%NANSEM Returns the answer to SEM = std(x)/sqrt(n-e), given a matrix x, either as a single
%value or column/row specified by 'dim'. If n-e<=0, returns 0.
function [ SEM ] = nanSEM(x, dim)
%NANSEM Returns the answer to SEM = std(x)/sqrt(n), given a matrix x, either as a single
%value or column/row specified by 'dim'.
if nargin<2
dim=0;
end
if nargin<3
e=0;
end
if dim>0
SEM=nanstd(x,[],dim);
n=sum(~isnan(x),dim)-e;
n=sum(~isnan(x),dim);
else
SEM=nanstd(reshape(x,1,numel(x)));
n=sum(sum(~isnan(x)))-e;
n=sum(sum(~isnan(x)));
end
n(n<=0)=nan;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment