Mercurial > hg > ishara
view signals/@sigarray/sigarray.m @ 1:289445d368a7
import.
author | samer |
---|---|
date | Wed, 19 Dec 2012 22:46:05 +0000 |
parents | |
children |
line wrap: on
line source
classdef sigarray < signal properties (GetAccess=private, SetAccess=immutable) fs array end methods function s=sigarray(array,rate) if nargin<2, rate=nan; end s.array=array; s.fs=rate; end function s=tostring(sig) s=sprintf('sigarray(<%dx%d>)',size(sig.array,1),size(sig.array,2)); end function c=channels(s), c=size(s.array,1); end function c=rate(s), c=s.fs; end function s=construct(sig) array=sig.array; ch=size(array,1); length=size(array,2); pos=0; s.start = @nop; s.stop = @nop; s.dispose = @nop; s.reader = @reader; function r=reader(n) r = @next; CHUNK = 1:uint32(n); function [x,rem]=next if pos+n<=length x=array(:,pos+CHUNK); rem=0; pos=pos+n; else rem=n-(length-pos); x=[array(:,pos+1:end),zeros(ch,rem)]; pos=length; end end end end end end