:orphan:
# MatGetValue
Gets a single value from a matrix
## Synopsis
```
static inline PetscErrorCode MatGetValue(Mat mat, PetscInt row, PetscInt col, PetscScalar *va)
```
Not Collective; can only return a value owned by the given process
## Input Parameters
- ***mat -*** the matrix
- ***row -*** the row location of the entry
- ***col -*** the column location of the entry
## Output Parameter
- ***va -*** the value
## Notes
The matrix must have been assembled with `MatAssemblyBegin()` and `MatAssemblyEnd` before this call
For efficiency one should use `MatGetValues()` and get several values simultaneously.
See notes for `MatGetValues()`.
## See Also
[](ch_matrices), `Mat`, `MatAssemblyBegin()`, `MatAssemblyEnd`, `MatSetValue()`, `MatGetValueLocal()`, `MatGetValues()`
## Level
advanced
## Location
include/petscmat.h
## Examples
src/snes/tutorials/ex48.c
src/ts/tutorials/ex14.c
---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/include/petscmat.h)
[Index of all Mat routines](index.md)
[Table of Contents for all manual pages](/manualpages/index.md)
[Index of all manual pages](/manualpages/singleindex.md)