Mercurial > hg > ishara
diff general/numerical/minmax.m @ 4:e44f49929e56
Adding reorganised general toolbox, now in several subdirectories.
author | samer |
---|---|
date | Sat, 12 Jan 2013 19:21:22 +0000 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/general/numerical/minmax.m Sat Jan 12 19:21:22 2013 +0000 @@ -0,0 +1,15 @@ +function R=minmax(X,I) +% minmax - return minimum and maximum along a particular dimension +% +% minmax :: [[N,M]], 1:natural -> [[2,M]]. +% minmax :: [[N,M]], 2:natural -> [[N,2]]. +% minmax :: [D:[[1,E]]], I:[E] -> [set(D,I,2)]. +% +% The most general type means that the return array is the same size +% as the input array except that the size along the Ith dimension +% becomes 2, first element is min, second is max. +% +% The functions is constructed so that it is idemponent: +% minmax(X,I) == minmax(minmax(X,I),I) + +R= cat(I,min(X,[],I),max(X,[],I));