view arrows/amatrix.m @ 61:eff6bddf82e3 tip

Finally implemented perceptual brightness thing.
author samer
date Sun, 11 Oct 2015 10:20:42 +0100
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