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.
MATLAB Engine API for Python enables you to use the MATLAB
doc
and help
functions. Use
doc
to open the MathWorks® documentation in your system web browser. Use help
to get a brief description of a MATLAB function at the Python prompt.
Open MathWorks Documentation from Python
From Python, you can 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
documentation home page. (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 documentation. 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. This MATLAB function returns the Error Function evaluated for each element of x. Syntax erf(x) Input Arguments x - Input real number | vector of real numbers | matrix of real numbers | multidimensional array of real numbers Examples Find Error Function Find Cumulative Distribution Function of Normal Distribution Calculate Solution of Heat Equation with Initial Condition See also erfc, erfcinv, erfcx, erfinv Introduced in MATLAB before R2006a Documentation for erf Other uses of erf
The output displays the help text, but does not include any links to help for other MATLAB functions that might be mentioned.