Main Content

setTargetConnectionStatusCallback

Set callback function to trigger when status of connection to target computer changes

Since R2022b

    Description

    setTargetConnectionStatusCallback(callback) triggers a callback upon change in the connection status of a target computer.

    example

    Examples

    collapse all

    Display the status of the target connection using the following function where status is the change in status of target connection.

    function targetConnectionCallback(status)
    if status   
       disp('Target connected');
    else
       disp('Target disconnected');
    end
    end
    tg.setTargetConnectionStatusCallback(@targetConnectionCallback);

    Input Arguments

    collapse all

    Provide a function with required action to occur when connection status of the target gets changed. The callback is expected to have 1 input argument representing the connection status.

    Version History

    Introduced in R2022b