Main Content

enableservice

Enable, disable, or report status of MATLAB Automation server

    Description

    state = enableservice("AutomationServer",enable) enables or disables the MATLAB® Automation server and returns the previous state.

    example

    state = enableservice("AutomationServer") returns the current state of the Automation server.

    example

    Examples

    collapse all

    state = enableservice("AutomationServer",true)
    state =
    
      logical
    
       0

    Previously, MATLAB was not an Automation server.

    state = enableservice("AutomationServer")
    
    state =
    
      logical
    
       1

    MATLAB is an Automation server.

    Input Arguments

    collapse all

    Option to enable server, specified as a 1 (true) or 0 (false). If enable is 1 (true), the function converts an existing MATLAB session to an Automation server. If enable is 0 (false), the function disables the MATLAB Automation server.

    Output Arguments

    collapse all

    Status of the MATLAB Automation server, returned as a 1 or 0. If state is 1 (true), MATLAB is an Automation server. If state is 0 (false), MATLAB is not an Automation server.

    Tips

    • To create a MATLAB Automation server at startup, use this command at the Windows operating system prompt:

      matlab -automation

      COM functions are available only on Microsoft® Windows® systems.

    Version History

    Introduced before R2006a