Your answer is one click away!

shanty February 2016
### Undefined function 'sparse' for input arguments of type 'sym'. (Matlab)

I'm trying to create a sparse matrix that has non-numeric elements.

```
syms a b c;
i = [1 1 2 2];
j = [1 2 1 2];
s = [a b 3 c];
sparse(i,j,s,2,2)
```

which returns this error:

Undefined function 'sparse' for input arguments of type 'sym'.

Error in Test2 (line 8)

sparse(i,j,s,2,2)

As I stated in the comments, there is no such thing as a sparse symbolic matrix in Matlab. This is stated in the documentation for the third input argument for the form of `sparse`

you're using:

v — Values

scalar | vector | matrix

...

Data Types:double | logical

Matlab's Symbolic Math (and MuPAD) may take advantage of inherent sparsity internally (for storage and computation).

Asked in February 2016

Viewed 2,926 times

Voted 7

Answered 2 times

Viewed 2,926 times

Voted 7

Answered 2 times