
stop(ao1);
delete(ao1);


stop(ao);
delete(ao);

% pause;

ao=analogoutput('nidaq');
addchannel(ao, 0);
ch0=ao.Channel;

ao1=analogoutput('nidaq');
addchannel(ao1, 1);
ch1=ao1.Channel;


sampleRate=500;
set(ao,'SampleRate',sampleRate);
set(ao1,'SampleRate',sampleRate);

set(ao, 'TriggerType', 'Immediate');
set(ao, 'RepeatOutput',0);

set(ao1, 'TriggerType', 'Immediate');
set(ao1, 'RepeatOutput', 0);

%------------------------------------------------------

f=0;
tic

for i=1:24,
    putdata(ao, [3]);
    start(ao); 
    stop(ao);
 
    putdata(ao1, [2]);
    start(ao1); 
    stop(ao1);
    
%     if i==10,
%     
%       putdata(ao, [1.25]);
%       start(ao); 
%       stop(ao);
%  
%       putdata(ao1, [3.71]);
%       start(ao1); 
%       stop(ao1);
%           disp('testar') ;
%           pause;
%     end
    

end

toc

z=0;
putdata(ao, [z]');
start(ao);

stop(ao);

z1=0;
putdata(ao1, [z1]');
start(ao1);

stop(ao1);

%delete(ao);