Analog Output Test

ao = analogoutput('mcc',0);
addchannel(ao,0);
% Although the default rate is 1000,
% the maximum rate is 10,000
disp('SampleRate');
disp(propinfo(ao,'SampleRate'))
SampleRate
               Type: 'double'
         Constraint: 'bounded'
    ConstraintValue: [1 10000]
       DefaultValue: 1000
           ReadOnly: 'whileRunning'
     DeviceSpecific: 0

% queue data for output

set(ao,'SampleRate',1000);
tmax=10;
fs = 1000;
t = linspace(0,tmax,tmax*fs+1);
freq = 50;
dt = 1/freq;
%data = 2+0.05*mod(t,dt)/dt;
data = sin(2*pi*freq*t)+2.5;
putdata(ao,data');
tic;
start(ao);

% It appears that system sends out
% data at 1000 samples per second until
% the queue has emptied.

wait(ao,tmax+1); % wait for 11 seconds
toc
Elapsed time is 10.054606 seconds.

% change frequency
set(ao,'SampleRate',5000);
putdata(ao,data');
start(ao);
wait(ao,6);

for obj=daqfind
    delete(obj);
end
clear ao ai dio obj