CAWT 2.9.6 Reference Manual

::MatlabTop, Main, Index

The Matlab namespace provides commands to control MathWorks Matlab.

CommandsTop, Main, Index

ExecCmd [::Matlab]Top, Main, Index

Execute a Matlab command.

ExecCmd appId cmd
Parameters
appIdIdentifier of the Matlab instance.
cmdString containing the Matlab command being executed.
Return value

Returns the Matlab answer as a string.

proc ::Matlab::ExecCmd {appId cmd} {

    # Execute a Matlab command.
    #
    # appId - Identifier of the Matlab instance.
    # cmd   - String containing the Matlab command being executed.
    #
    # Returns the Matlab answer as a string.

    set retVal [$appId Execute $cmd]
    return $retVal
}

Open [::Matlab]Top, Main, Index

Open a Matlab instance.

Open ?visible?
Parameters
visibleIf set to true, show the application window. Otherwise hide the application window. Optional, default true.
Description

Use an already running instance, if available.

Return value

Returns the identifier of the Matlab application instance.

See also

OpenNew, Visible, Quit

proc ::Matlab::Open {{visible true}} {

    # Open a Matlab instance.
    #
    # visible - If set to true, show the application window.
    #           Otherwise hide the application window.
    #
    # Use an already running instance, if available.
    #
    # Returns the identifier of the Matlab application instance.
    #
    # See also: OpenNew Visible Quit

    variable matlabAppName

    set appId [Cawt GetOrCreateApp $matlabAppName true]
    Matlab Visible $appId $visible
    return $appId
}

OpenNew [::Matlab]Top, Main, Index

Open a new Matlab instance.

OpenNew ?visible?
Parameters
visibleIf set to true, show the application window. Otherwise hide the application window. Optional, default true.
Return value

Returns the identifier of the new Matlab application instance.

See also

Open, Visible, Quit

proc ::Matlab::OpenNew {{visible true}} {

    # Open a new Matlab instance.
    #
    # visible - If set to true, show the application window.
    #           Otherwise hide the application window.
    #
    # Returns the identifier of the new Matlab application instance.
    #
    # See also: Open Visible Quit

    variable matlabAppName

    set appId [Cawt GetOrCreateApp $matlabAppName false]
    Matlab Visible $appId $visible
    return $appId
}

Quit [::Matlab]Top, Main, Index

Quit a Matlab instance.

Quit appId
Parameters
appIdIdentifier of the Matlab instance.
Return value

Returns no value.

See also

Open

proc ::Matlab::Quit {appId} {

    # Quit a Matlab instance.
    #
    # appId - Identifier of the Matlab instance.
    #
    # Returns no value.
    #
    # See also: Open

    $appId Quit
}

Visible [::Matlab]Top, Main, Index

Toggle the visibility of a Matlab application window.

Visible appId visible
Parameters
appIdIdentifier of the Matlab instance.
visibleIf set to true, show the application window. Otherwise hide the application window.
Return value

Returns no value.

See also

Open, OpenNew

proc ::Matlab::Visible {appId visible} {

    # Toggle the visibility of a Matlab application window.
    #
    # appId   - Identifier of the Matlab instance.
    # visible - If set to true, show the application window.
    #           Otherwise hide the application window.
    #
    # Returns no value.
    #
    # See also: Open OpenNew

    $appId Visible [Cawt TclInt $visible]
}