samer@4: function R=minmax(X,I) samer@4: % minmax - return minimum and maximum along a particular dimension samer@4: % samer@4: % minmax :: [[N,M]], 1:natural -> [[2,M]]. samer@4: % minmax :: [[N,M]], 2:natural -> [[N,2]]. samer@4: % minmax :: [D:[[1,E]]], I:[E] -> [set(D,I,2)]. samer@4: % samer@4: % The most general type means that the return array is the same size samer@4: % as the input array except that the size along the Ith dimension samer@4: % becomes 2, first element is min, second is max. samer@4: % samer@4: % The functions is constructed so that it is idemponent: samer@4: % minmax(X,I) == minmax(minmax(X,I),I) samer@4: samer@4: R= cat(I,min(X,[],I),max(X,[],I));