# argnames

Input variables of symbolic function or matrix function

## Syntax

``args = argnames(f)``

## Description

example

````args = argnames(f)` returns the input variables of the symbolic function or matrix function `f`.```

## Examples

collapse all

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 = $\left(\begin{array}{cc}x& y\end{array}\right)$`

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 = $\left(\begin{array}{cccc}x& b& y& a\end{array}\right)$`

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 = $A$`
`arg2 = args{2}`
`arg2 = $B$`

## Input Arguments

collapse all

Input function, specified as a symbolic function or symbolic matrix function.

Data Types: `symfun` | `symfunmatrix`

## Output Arguments

collapse all

Input variables of a symbolic function or matrix function.

• If `f` is a symbolic function of type `symfun`, then `args` is returned as a symbolic variable or a vector of symbolic variables of type `sym`.

• If `f` is a symbolic matrix function of type `symfunmatrix`, then `args` is returned as a cell array of symbolic matrix variables of type `symmatrix`.

Data Types: `sym` | `cell`

## Version History

Introduced in R2012a

expand all