annotate 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 |
|
rev |
line source |
samer@0
|
1 % amatrix - arrow to generate sequence by scanning through an array
|
samer@0
|
2 %
|
samer@0
|
3 % amatrix :: [[N,M]] -> arrow({},{[[N]]},1..M).
|
samer@0
|
4 function o=amatrix(X)
|
samer@0
|
5 state=1;
|
samer@0
|
6 len=size(X,2);
|
samer@0
|
7 o=unfolder(@sfn1,state);
|
samer@0
|
8
|
samer@0
|
9 function [x,S]=sfn(S)
|
samer@0
|
10 x=X(:,S);
|
samer@0
|
11 S=1+mod(S,len);
|
samer@0
|
12 end
|
samer@0
|
13
|
samer@0
|
14 function [x,S]=sfn1(S)
|
samer@0
|
15 if S>len, error('ARROW:EOF','End of arrow sequence'); end
|
samer@0
|
16 x=X(:,S);
|
samer@0
|
17 S=S+1;
|
samer@0
|
18 end
|
samer@0
|
19 end
|