1 ## Copyright (C) 2010 Mark Borgerding <mark@borgerding.net>
3 ## This program is free software; you can redistribute it and/or modify it under
4 ## the terms of the GNU General Public License as published by the Free Software
5 ## Foundation; either version 3 of the License, or (at your option) any later
8 ## This program is distributed in the hope that it will be useful, but WITHOUT
9 ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13 ## You should have received a copy of the GNU General Public License along with
14 ## this program; if not, see <http://www.gnu.org/licenses/>.
17 ## @deftypefn {Function File} {@var{outdata} =} helscanintrlv (@var{data}, @var{nrows}, @var{ncols},@var{Nshift})
18 ## @var{nrows}-by-@var{ncols}.
19 ## @seealso{helscandeintrlv}
22 function outdata = helscanintrlv(data,Nrows,Ncols,Nshift)
25 error('usage : interlvd = helscanintrlv(data,Nrows,Ncols,Nshift)');
28 if(~isscalar(Nrows) || ~isscalar(Ncols))
29 error("Nrows and Ncols must be integers");
32 if( Nrows ~= floor(Nrows)|| Ncols ~= floor(Ncols))
33 error("Nrows and Ncols must be integers");
37 if ( isvector(data) && columns(data) > rows(data) )
44 if size(data,1) ~= Nrows*Ncols
45 error("The length of data must be equals to Ncols*Nrows");
48 # create the interleaving indices
49 idx0 = 0:Nrows*Ncols-1;
50 idxMod = rem(idx0,Ncols);
51 idxFlr = idx0 - idxMod;
52 inds = 1+rem(idxFlr + idxMod * Ncols * Nshift + idxMod,Nrows*Ncols);
56 outdata(:,k) = data(inds,k);