Mercurial > hg > ishara
annotate general/arrutils/chunk.m @ 13:03694e5c8365
Reorganised some high order list functions to correct class-based method dispatch; fixed some docs.
author | samer |
---|---|
date | Wed, 16 Jan 2013 12:12:34 +0000 |
parents | e44f49929e56 |
children |
rev | line source |
---|---|
samer@4 | 1 function B=chunk(A,n,step) |
samer@13 | 2 % chunk - return chunk from inside matrix |
samer@13 | 3 % |
samer@13 | 4 % chunk :: |
samer@13 | 5 % [[N,M]] ~'source array', |
samer@13 | 6 % K:natural ~'index of chunk', |
samer@13 | 7 % L:natural ~'chunk size' |
samer@13 | 8 % -> [[L,M]] ~'K block of L rows'. |
samer@4 | 9 |
samer@4 | 10 i=n*step+1; |
samer@4 | 11 B=A(i:i+step-1,:); |
samer@4 | 12 |
samer@4 | 13 |