I have a setup with both recording and stimulating electrodes. I would like to record the effects of a certain stimulus which is basically designed by a slightly modified sinewave law and given as an output through an analog output channel in my recording session.
I am able able to record the signal through the recording electrodes. All good so far.
Fs = 20000;
s = daq.createSession('ni');
channels = [0 1];
stimulus = sin(2*pi*[1:120000]*700);
ch1 = addCounterOutputChannel(s,'Dev1','ctr0','PulseGeneration');
ch1.Frequency = 40;
ch1.DutyCycle = 0.1;
s.Rate = Fs;
It all works fine except that the digital trigger runs only for a short amount of time which depends on the amount of data points given by the stimulus.
Instead, I would like to extend the duration of the whole session beyond the duration of the output stimulus (let's say for instance 180 seconds, as in the example). uncommenting that line though, gives me an error ("DurationInSeconds cannot be set when there are output channels in the session. You must specify or change the amount of data queued to change the number of scans acquired."). I understand that basically the two output channels need to be linked and use the same "timebase"...is it possible to uncouple them ?
One solution would be to design a stimulus which includes blanks spaces (0 values) for the whole session duration except for the time when the analog output is active).
Is there a cleaner way ?