Mercurial > hg > ishara
view general/arrutils/sli.m @ 42:ae596261e75f
Various fixes and development to audio handling
author | samer |
---|---|
date | Tue, 02 Dec 2014 14:51:13 +0000 |
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{:});