p(k) returns the result of p applied to k. If k is out of bounds, 0 is returned.
0001 function j = subsref(p,S) 0002 % p(k) returns the result of p applied to k. 0003 % If k is out of bounds, 0 is returned. 0004 0005 n = length(p); 0006 args = S.subs; 0007 a = args(1); 0008 i = a{1}; 0009 if (i<1) | (i>n) 0010 j = 0; 0011 else 0012 j = p.array(i); 0013 end