argnames
Input variables of symbolic function or matrix function
Syntax
Description
Examples
Find Input Variables of Symbolic Function
Create a symbolic function.
syms f(x,y)
f(x,y) = x + y;
Find the input variables of f
by using argnames
.
args = argnames(f)
args =
Create another symbolic function.
syms f(a,b,x,y)
f(x,b,y,a) = a*x + b*y;
Find the input variables of f
. When returning variables, argnames
uses the same order as you used when you defined the function.
args = argnames(f)
args =
Find Input Variables of Symbolic Matrix Function
Create a symbolic matrix function.
syms A B 2 matrix syms f(A,B) 2 matrix keepargs f(A,B) = A*B - 3*A + 2*eye(2);
Find the input variables of f
by using argnames
. The result is a cell array containing symbolic matrix variables.
args = argnames(f)
args=1×2 cell array
{2x2 symmatrix} {2x2 symmatrix}
Access the contents of the cell array by indexing into it.
arg1 = args{1}
arg1 =
arg2 = args{2}
arg2 =
Input Arguments
f
— Input function
symbolic function | symbolic matrix function
Input function, specified as a symbolic function or symbolic matrix function.
Data Types: symfun
| symfunmatrix
Output Arguments
args
— Input variables of symbolic function or matrix function
symbolic variable | vector of symbolic variables | cell array of symbolic matrix variables
Input variables of a symbolic function or matrix function.
If
f
is a symbolic function of typesymfun
, thenargs
is returned as a symbolic variable or a vector of symbolic variables of typesym
.If
f
is a symbolic matrix function of typesymfunmatrix
, thenargs
is returned as a cell array of symbolic matrix variables of typesymmatrix
.
Data Types: sym
| cell
Version History
Introduced in R2012aR2022a: Find input variables of symbolic matrix functions
The argnames
function accepts an input argument of type
symfunmatrix
. For an example, see Find Input Variables of Symbolic Matrix Function.
See Also
formula
| syms
| symvar
| symfun
| symfunmatrix
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)