matlabFunction
Convert symbolic expression to function handle or file
Description
uses additional options specified by one or more g
= matlabFunction(___,Name,Value
)Name,Value
pair arguments. You can specify Name,Value
after the input
arguments used in the previous syntaxes.
Examples
Input Arguments
Output Arguments
Limitations
Some symbolic functions that have no corresponding MATLAB functions operating on
double
data type, such assimplify
andsolve
, are kept as symbolic functions in the converted MATLAB function handle or file. The converted file that consists of these functions cannot be deployed using MATLAB Coder™ or MATLAB Compiler™. You need to create your own functions withdouble
data type to replace these symbolic functions. If you are interested in a symbolic function that cannot be deployed, please contact MathWorks Technical Support.
Tips
When you use the
File
argument, userehash
to make the generated function available immediately.rehash
updates the MATLAB list of known files for directories on the search path.If the
File
option is empty, then an anonymous function is returned.Use
matlabFunction
to convert one or more symbolic expressions to a MATLAB function and write the resulting function to an M-file. You can then use the generated M-file to create standalone applications and web apps using MATLAB Compiler. For example, see Deploy Generated MATLAB Functions from Symbolic Expressions with MATLAB Compiler.Use
matlabFunction
to convert one or more symbolic expressions to a MATLAB function and write the resulting function to an M-file. You can then use the generated M-file to create C or C++ code using MATLAB Coder app. For example, see Generate C Code from Symbolic Expressions Using the MATLAB Coder App.To generate a MATLAB function with input arguments that are a combination of scalar and vector variables, specify the name-value argument
Vars
as a cell array. For examples, see Specify Input Arguments for Generated Function and Generate Function with Vector Input Arguments.
Version History
See Also
ccode
| daeFunction
| fortran
| rehash
| matlabFunctionBlock
| odeFunction
| simscapeEquation
| subs
| sym2poly