Error: EXTRAPVAL must be a scalar

27 views (last 30 days)
Jing Ci Neo
Jing Ci Neo on 27 Jul 2020
Commented: Jing Ci Neo on 29 Jul 2020
I want to interpolate and extrapolate my matrix using interp2. Why am I getting the error "EXTRAPVAL must be a scalar"?
Below is my code, n and m are integers and C is an m by n matrix.
[X,Y] = meshgrid(0.5:n-0.5,0.5:m-0.5);
[Xq,Yq] = meshgrid(0:n,0:m);

Accepted Answer

Stephen23 on 27 Jul 2020
Edited: Stephen23 on 27 Jul 2020
According to the interp2 documentation, the extrapval must be a scalar numeric:
A character vector is not supported. Only a scalar constant value is supported.
If you expect the extrapolation to calculate some value then you will need to either:

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!