samer@34: function x=srdata(gen,s0,varargin) samer@34: % srdata - Signal as a sequence of blocks from signal generator object samer@34: % samer@34: % srdata :: samer@34: % gen(A,B{1:N}) ~'signal generator object', samer@34: % A ~'initial state', samer@34: % seq(B{1} ~'sequence of 1st param values', samer@34: % ... samer@34: % seq(B{N} ~'sequence of Nst param values', samer@34: % -> seq([[1,_]]). samer@34: % samer@34: % The main point of this construct is to maintain state samer@34: % between calls to the block method of the signal generator, and samer@34: % also to supply the generator with a sequence of parameter samer@34: % values. samer@34: samer@36: x=mapaccum(@blockgen,s0,zip(varargin{:})); samer@34: samer@34: function [y,state]=blockgen(theta,state) samer@34: % this is weird - for some reason Matlab crashes if I call block samer@34: % directly from here, but is ok if I go via the non-nested bblock samer@34: [y,state]=bblock(gen,state,theta); samer@34: end samer@34: end samer@34: samer@34: function [y,s]=bblock(gen,s,theta) samer@34: [y,s]=block_sr(gen,s,theta{:}); samer@34: end samer@34: