SendCustomPulseTrain()
Description
Sends a sequence of onset times and voltages describing a train of monophasic pulses.
The train can be mapped to any output channel by specifying a custom train ID in the output channel's parameters (see ProgramPulsePal).
Two custom trains can be created, with 1,000 pulses each (PulsePal r0.4).
While this function allows custom onset times, the duration of each pulse in the custom train is set by adjusting each output channel's parameters.
Pulses that are continuous or overlapping will merge (see the Parameter guide)
Syntax
ConfirmBit = SendCustomPulseTrain(TrainID, PulseTimes, Voltages)
Parameters
TrainID: The custom train to program (1 or 2)
PulseTimes: A 1 x n array of up to 1,000 pulse onset times in seconds.
The pulse times may range from 0 to 3600 seconds, and must be multiples of 0.0001s.
Pulse times must be positive and monotonically increasing.
Voltages: A vector of the voltage of each pulse in the train.
There must be a voltage for each pulse.
Votages can range from -10 to 10V.
Returns
1 if custom train was sent successfully.
0 if an error occurred during transmission.
Example
% 1. This code generates a train of three 250μs pulses when trigger channel 2 receives a TTL pulse.
% The pulses occur at at times 0ms, 1ms and 10ms.
% Their voltages are -8V, 2V and 10V.
Voltages = [-8 2 10];
PulseTimes = [0 .001 .01];
SendCustomPulseTrain(1, PulseTimes, Voltages); % Uploads our train in slot 1 of 2
% For the next three lines, note the parameter codes for ProgramPulsePalParam.
ProgramPulsePalParam(1, 14, 1); % Sets output channel 1 to use custom train 1
ProgramPulsePalParam(1, 4, 0.00025); % Sets output channel 1 to use 250μs pulses
ProgramPulsePalParam(1, 13, 1); % Sets output channel 1 to respond to triggers on trigger channel 2
TriggerPulsePal('1');
% 2. This code accomplishes the same thing
% but using ProgramPulsePal instead of ProgramPulsePalParam to adjust output channel settings.
Voltages = [-8 2 10];
PulseTimes = [0 .001 .01];
SendCustomPulseTrain(1, PulseTimes, Voltages); % Uploads our train in memory location 1 of 2
load('C:\Users\JohnDoe\Documents\MATLAB\PulsePal 0_4\Programs\PulsePalProgram_Example.mat');
% Note the layout of parameters in the example matrix.
ParameterMatrix{15,2} = 1; % Sets output channel 1 to use custom train 1.
ParameterMatrix{5,2} = 0.00025; % Sets output channel 1 to use 250μs pulses
ParameterMatrix{14,2} = 1; % Sets output channel 1 to respond to triggers on trigger channel 2
ProgramPulsePal(ParameterMatrix); % Sends parameter changes to Pulse Pal
TriggerPulsePal('1');