# 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
For efficiency one should use `MatGetValues()` and get several values simultaneously.

See notes for `MatGetValues()`.




## See Also
 `MatSetValue()`, `MatGetValueLocal()`, `MatGetValues()`

## Level
advanced

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/include/petscmat.h.html#MatGetValue">include/petscmat.h</A>

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/tutorials/ex48.c.html">src/snes/tutorials/ex48.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/tutorials/ex14.c.html">src/ts/tutorials/ex14.c.html</A><BR>


---
[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](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
