|On this page…|
Most trigger properties can be set in the same way you set any other image acquisition object property: referencing the property as you would a field in a structure using dot notation. For example, you can specify the value of the TriggerRepeat property, where vid is a video input object created using the videoinput function.
vid.TriggerRepeat = Inf
For more information, see Configuring Image Acquisition Object Properties.
Some trigger properties, however, are interrelated and require the use of the triggerconfig function to set their values. These properties are the TriggerType, TriggerCondition, and TriggerSource properties. For example, some TriggerCondition values are only valid when the value of the TriggerType property is 'hardware'.
Setting the values of the TriggerType, TriggerSource, and TriggerCondition properties can be a two-step process:
Determine valid configurations of these properties by calling the triggerinfo function.
For an example of using these functions, see Using a Hardware Trigger.
To find all the valid configurations of the TriggerType, TriggerSource, and TriggerCondition properties, use the triggerinfo function, specifying a video input object as an argument.
config = triggerinfo(vid);
This function returns an array of structures, one structure for each valid combination of property values. Each structure in the array is made up of three fields that contain the values of each of these trigger properties. For example, the structure returned for an immediate trigger always has these values:
TriggerType: 'immediate' TriggerCondition: 'none' TriggerSource: 'none'
A device that supports hardware configurations might return the following structure.
TriggerType: 'hardware' TriggerCondition: 'risingEdge' TriggerSource: 'TTL'
Note The text strings used as the values of the TriggerCondition and TriggerSource properties are device specific. Your device, if it supports hardware triggers, might support different condition and source values.
To set the values of the TriggerType, TriggerSource, and TriggerCondition properties, you must use the triggerconfig function. You specify the value of the property as an argument to the function.
For example, this code sets the values of these properties for a hardware trigger.
If you are specifying a manual trigger, you only need to specify the trigger type value as an argument.
You can also pass one of the structures returned by the triggerinfo function to the triggerconfig function and set all three properties at once.
See the triggerconfig function documentation for more information.