Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Get Help for MATLAB Functions from Python

How to Find MATLAB Help

From Python®, you can access supporting documentation for all MATLAB® functions. This documentation includes examples and describes input arguments, output arguments, and calling syntax for each function.

The MATLAB Engine API for Python enables you to use the MATLAB doc and help functions. Use doc to open the MATLAB Help browser. Use help to get a brief description of a MATLAB function at the Python prompt.

Open MATLAB Help Browser from Python

From Python, you can use the Help browser to open MATLAB function reference pages and search the documentation.

For example, display the reference page for the MATLAB plot function. (Since doc returns no output arguments, you must set nargout=0. )

import matlab.engine
eng = matlab.engine.start_matlab()
eng.doc("plot",nargout=0)

The reference page includes a description of the function, examples, and links to related documentation.

Note

Click an example title, or on the arrow next to a title, if you do not see the examples on a MATLAB reference page. Examples can be collapsed or expanded within a page.

If you call eng.doc with no positional arguments, it opens the Help browser. (You still must set the keyword argument nargout=0).

eng.doc(nargout=0)

To search the MATLAB documentation, type an expression in the search box at the top of any page in the Help browser. The browser returns a list of search results, highlighting words that match the expression.

Alternatively, you can search the documentation with the docsearch function. For example, search for pages that mention plot.

eng.docsearch("plot",nargout=0)

Display MATLAB Help at Python Prompt

To display help text for a function at the Python prompt, call the MATLAB help function. For example, display the help text for erf.

import matlab.engine
eng = matlab.engine.start_matlab()
eng.help("erf",nargout=0)
 ERF Error function.
    Y = ERF(X) is the error function for each element of X.  X must be
    real. The error function is defined as:
 
      erf(x) = 2/sqrt(pi) * integral from 0 to x of exp(-t^2) dt.
 
    See also ERFC, ERFCX, ERFINV, ERFCINV.

    Other functions named erf:
       codistributed/erf
       gpuArray/erf
       sym/erf

    Reference page in Help browser
       doc erf

The output displays the help text, but does not include any links to help for other MATLAB functions that might be mentioned.

Was this topic helpful?