Functions | |
if (nargin==1) opt | |
elseif (nargin==2) if(ischar(opt1)) opt | |
elseif (ischar(opt2)) opt | |
else | error ("mean: expecting opt to be a string") |
endif else | print_usage () |
endif | if (need_dim) t |
if (isempty(t)) dim | |
endif endif | if (dim > ndims(x)) n |
endif | if (strcmp(opt,"a")) y |
elseif (strcmp(opt,"g")) y | |
elseif (strcmp(opt,"h")) y | |
else | error ("mean: option `%s' not recognized", opt) |
!assert (mean(x)==0 &&mean(y)==0 &&mean(z)==[0, 10]) | |
!error | mean () |
!error | mean (1, 2, 3) |
Variables | |
function | y |
need_dim = 1 | |
else | dim = opt1 |
opt = "a" | |
else | sz = size (x) |
n = sz (dim) | |
endif endfunction!test | !x = -10:10 |
!y = x' | |
!z = [y, y+10] |
!assert | ( | mean(x) | = =0 &&mean(y)==0 &&mean(z)==[0 , |
|
10] | ||||
) |
elseif | ( | strcmp(opt,"h") | ) |
elseif | ( | strcmp(opt,"g") | ) |
elseif | ( | ischar(opt2) | ) |
elseif | ( | nargin | = =2 |
) |
endif if | ( | strcmp(opt,"a") | ) |
if | ( | isempty(t) | ) |
if | ( | nargin | = =1 |
) |
!error mean | ( | 1 | , | |
2 | , | |||
3 | ||||
) |
!error mean | ( | ) |
endif endfunction !test !x = -10:10 |
!y = x' |
!z = [y, y+10] |
n = sz (dim) |
need_dim = 1 |
opt = "a" |
else sz = size (x) |