Functions | |
endif | if (nargin< 2) dim |
endif | if (numel(a) > 0) n |
if (mod(n, 2)==1) retval | |
endif else | error ("median: invalid matrix argument") |
!assert ((median(x)==median(x2)&&median(x)==3.5%!&&median(y)==median(y2)&&median(y)==4%!&&median([x2, 2 *x2])==[3.5, 7]%!&&median([y2, 3 *y2])==[4, 12])) | |
!error | median () |
!error | median (1, 2, 3) |
Variables | |
function | retval |
k = floor ((n+1) / 2) | |
endif endfunction!test | !x = [1, 2, 3, 4, 5, 6] |
!x2 = x' | |
!y = [1, 2, 3, 4, 5, 6, 7] | |
!y2 = y' |
!assert | ( | (median(x)==median(x2)&&median(x)==3.5%!&&median(y)==median(y2)&&median(y)==4%!&&median([x2, 2 *x2])==[3.5, 7]%!&&median([y2, 3 *y2])==[4, 12]) | ) |
if | ( | mod(n, 2) | = =1 |
) |
endif if | ( | numel(a) | , | |
0 | ||||
) |
endif if | ( | ) |
!error median | ( | 1 | , | |
2 | , | |||
3 | ||||
) |
!error median | ( | ) |
endif endfunction !test !x = [1, 2, 3, 4, 5, 6] |
!x2 = x' |
!y = [1, 2, 3, 4, 5, 6, 7] |
!y2 = y' |
k = floor ((n+1) / 2) |