function MultipleCounterTest
d.Chassis = daq.getVendors;
s = daq.createSession(d.Chassis.ID);
s.addAnalogInputChannel('cDAQ1Mod2','ai2','Voltage');
s.addCounterInputChannel('cDAQ1Mod4','ctr0','EdgeCount');
s.addCounterInputChannel('cDAQ1Mod4','ctr1','EdgeCount');
s.DurationInSeconds = 1;
s.Rate = 1*1E2;
l = s.addlistener('DataAvailable',@f);
function f(src,event)
hold on;
figure(1);
A = event.Data(:,2);
h = plot(event.TimeStamps,A);
set(h,'Visible','On');
set(gca,'Visible','On');
set(gca,'XLim',[0,s.DurationInSeconds]);
set(gca,'YLim',[-max(A)/5,max(A)*6/5]);
set(h,'LineStyle','-');
set(h,'LineWidth',1);
set(h,'Color','Green');
set(h,'Marker','o');
set(h,'MarkerSize',1.5);
set(h,'MarkerEdgeColor','Green');
set(h,'MarkerFaceColor',[1,1,1]);
hold on;
figure(2);
B = event.Data(:,3);
h = plot(event.TimeStamps,B);
set(h,'Visible','On');
set(gca,'Visible','On');
set(gca,'XLim',[0,s.DurationInSeconds]);
set(gca,'YLim',[-max(B)/5,max(B)*6/5]);
set(h,'LineStyle','-');
set(h,'LineWidth',1);
set(h,'Color','Black');
set(h,'Marker','o');
set(h,'MarkerSize',1.5);
set(h,'MarkerEdgeColor','Black');
set(h,'MarkerFaceColor',[1,1,1]);
hold off;
end
s.startBackground();
s.wait();
delete(l);
s.stop;
s.release;
end