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.
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)
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.