function nummarkers(h,hnum)
% NUMMARKERS takes a vector of line handles in h
% and reduces the number of plot markers on the lines
% to num. This is useful for closely sampled data.
%
% example:
% t = 0:0.01:pi;
% p = plot(t,sin(t),'-*',t,cos(t),'r-o');
% nummarkers(p,10);
% legend('sin(t)','cos(t)')
%
% Created: Magnus Sundberg Feb 08, 2001
% Modified: [email]felonwan@gmail.com[/email] May 25, 2013
lh=length(h);
lhn=length(hnum);
if (lhn~=lh && lhn~=1)
error('The number of markers should be a scalar or a vector with equal length to the number of lines!')
end
for n = 1:lh
if lhn==1
num=hnum;
elseif lhn==lh
num=hnum(n);
end
if strcmp(get(