Main Content

isrunning

Determine if video input object is ready to acquire data

    Description

    tf = isrunning(obj) returns logical 1 (true) if the video input object obj is ready to acquire data and 0 (false) otherwise. A video input object is ready to acquire data if the value of its Running property is 'on'.

    example

    Examples

    collapse all

    Create a video input object that connects to hardware such as a Windows web cam. Configure it with a manual trigger.

    obj1 = videoinput("winvideo",1,"MJPG_1280x720");
    triggerconfig(obj,"manual");
    

    The object is not yet ready to acquire data.

    tf = isrunning(obj1)
    tf =
    
      logical
    
       0

    Starting the object puts it into the running state.

    start(obj1)

    You can verify this state by examining the Running property or using isrunning.

    obj1.Running
    ans =
    
        'on'
    tf = isrunning(obj1)
    tf =
    
      logical
    
       1

    Now, create a second video object.

    obj2 = videoinput("winvideo");

    Use isrunning to determine which of the two objects is ready to acquire data.

    tf = isrunning([obj1 obj2])
    tf =
    
      1×2 logical array
    
       1   0

    Input Arguments

    collapse all

    Video input object to query, specified as a video input object created using videoinput.

    Output Arguments

    collapse all

    Whether obj is ready to acquire data, returned as numeric or logical 1 (true) or 0 (false).

    If obj is an array of video input objects, tf is an array where each element indicates whether the corresponding element in obj is ready to acquire data.

    Version History

    Introduced before R2006a