how to value nan number in a vector? and how to do the same calc in a 2d matrix?
Ältere Kommentare anzeigen
--I have a vactor where some values are NaN.The results are on the following plot(in the red box the nan) :

--I was wondering if there is a way to assume the values so it will be something like this:

---Also how to do the same procedure if some values of 2d matrix is NaN? Thanks in advance.
Akzeptierte Antwort
Weitere Antworten (1)
Iain
am 2 Okt. 2014
You've got an x & y vector, so this would remove the NaNs:
nans = isnan(Y) || isnan(X);
Y(nans) = [];
X(nans) = [];
You'll need to interpolate if you want the X & Y for all the values of your original X.
Kategorien
Mehr zu Data Type Conversion finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!