How can I make a synchronization between two sessions? AO and AI. I have a code:
aoSession = daq.createSession('ni');
aoSession.addAnalogOutputChannel('dev2', 0:1, 'Voltage');
rate = 250000;
aoSession.Rate = rate;
aiSession = daq.createSession('ni');
aiSession.addAnalogInputChannel('dev2', 'ai0', 'Voltage');
aiSession.Rate = 250000;
Xmin = -5;
Xmax = 5;
Ymin = -5;
Ymax = 5;
Xresolution = 256;
Yresolution = 256;
XX = 0;
YY = 0;
TimeCalculatingArray = 0;
tic
for iX = Xmin : (Xmax - Xmin)/(Xresolution-1) : Xmax
for iY = Ymin : (Ymax - Ymin)/(Yresolution-1) : Ymax
XX = [XX, iX];
YY = [YY, iY];
end
end
outputData(:,1) = XX;
outputData(:,2) = YY;
TimeCalculatingArray = toc
TimeQueue = 0;
tic
for i = 0:1:100
queueOutputData(aoSession, outputData);
end
TimeQueue = toc
TimeScaning = 0;
tic
startForeground(aoSession);
%%%%Here I what to start a synchronizide with AO session of Analog Input like that:
startForeground(aiSession);
%%%%
TimeScaning = toc