Main Content

triggerconfig

Configure video input object trigger properties

Description

triggerconfig(videoinput,type) sets the value of the TriggerType property of the videoinput object to the value specified in the type argument. For a list of valid TriggerType values, call triggerinfo(videoinput).

example

triggerconfig(videoinput,type,condition) sets the values of the TriggerType and TriggerCondition properties of the videoinput object to the values specified in the type and condition arguments, respectively. For a list of valid TriggerType and TriggerCondition values, call triggerinfo(videoinput). type and condition must specify a unique trigger configuration.

triggerconfig(videoinput,type,condition,source) sets the values of the TriggerType, TriggerCondition, and TriggerSource properties of the videoinput to the values specified in type, condition, and source arguments, respectively. For a list of valid TriggerType, TriggerCondition, and TriggerSource values, use triggerinfo(videoinput).

configOut = triggerconfig(videoinput) returns a MATLAB® structure, configOut, containing the current trigger configuration of the object. videoinput must be a 1-by-1 video input object.

triggerconfig(videoinput,configIn) configures the TriggerType, TriggerCondition, and TriggerSource property values for video input object videoinput by using configIn, a MATLAB structure with the field names TriggerType, TriggerCondition, and TriggerSource, each containing the desired property value.

Note

To get a list of options you can use on a function, press the Tab key after entering a function on the MATLAB command line. The list expands, and you can scroll to choose a property or value.

example

Examples

collapse all

Construct a video input object.

vid = videoinput("winvideo",1);

Configure the trigger properties for the object by setting the trigger type to "manual". When you set the trigger type to "manual", data logging occurs when you call the trigger function..

triggerconfig(vid,"manual")

Start the videoinput object to acquire image data, pause for 5 seconds, and then display the number of acquired frames. Observe that no frames are acquired.

start(vid)
pause(5)
vid.FramesAcquired
ans = 
0

Trigger the acquisition, wait until the image acquisition stops, and then display the number of acquired frames. Observe that 10 frames are acquired.

trigger(vid)
wait(vid)
vid.FramesAcquired
ans = 
10

Remove the videoinput object from memory.

delete(vid)

Create a video input object

vid = videoinput("winvideo", 1);

Use triggerinfo to get all valid configurations for the trigger properties.

config = triggerinfo(vid);

Pass one of the configurations to the triggerconfig function.

triggerconfig(vid, config(2))

Remove the video input object from memory.

delete(vid)

Input Arguments

collapse all

Video input, specified as a single videoinput object or an array of videoinput objects.

If an error occurs, the function restores any configured videoinput objects in the array to their original configurations.

Unique trigger configuration, specified as "immediate", "hardware", or "manual". For more information about the trigger types, see TriggerType.

Data Types: char | string

Trigger condition, specified as a string or a character vector. The trigger conditions that you can specify depend on the value of the TriggerType property. For more information about the trigger condition values, see TriggerCondition.

Data Types: char | string

Trigger source, specified as a string or a character vector. For more information about the trigger sources, see TriggerSource.

Data Types: char | string

Trigger configuration, specified as a MATLAB structure. The field names of configIn are TriggerType, TriggerCondition, and TriggerSource. Specify the fields of the structure to the desired property value.

Output Arguments

collapse all

Current trigger configuration, returned as a MATLAB structure. The field names of configOut are TriggerType, TriggerCondition, and TriggerSource. Each field contains the current value of the property of the object.

Version History

Introduced before R2006a