view arrows/amatrix.m @ 6:0ce3c2070089

Removed duplicate code and fixed doc in timed_action.
author samer
date Mon, 14 Jan 2013 14:33:37 +0000
parents 672052bd81f8
children
line wrap: on
line source
% amatrix - arrow to generate sequence by scanning through an array
%
% amatrix :: [[N,M]] -> arrow({},{[[N]]},1..M).
function o=amatrix(X)
	state=1;
	len=size(X,2);
	o=unfolder(@sfn1,state);

	function [x,S]=sfn(S)
		x=X(:,S);
		S=1+mod(S,len);
	end

	function [x,S]=sfn1(S)
		if S>len, error('ARROW:EOF','End of arrow sequence'); end
		x=X(:,S);
		S=S+1;
	end
end