Mercurial > hg > ishara
view general/arrutils/sli.m @ 61:eff6bddf82e3 tip
Finally implemented perceptual brightness thing.
author | samer |
---|---|
date | Sun, 11 Oct 2015 10:20:42 +0100 |
parents | e44f49929e56 |
children |
line wrap: on
line source
function y=sli(x,i,dim) % sli - Take a slice of a multidimensional array % % sli :: % [Size:[[E]]->A] ~'E dimensional array of size Size, element type A', % [[M]->1..Size(Dim)] ~'vector of M indices in Dim'th dimension', % Dim:1..E ~'dimension to act along' % -> [Size2:[[E]]->A] ~'new array of size Size2 :- % Size2=set(Size,Dim,M) ~'new size same as old but with Dim'th entry replaced with M'. n=ndims(x); idx=repmat({':'},1,n); idx{dim}=i; y=x(idx{:});