how to re-insert elements into a vector

1 Ansicht (letzte 30 Tage)
Sehoon Chang
Sehoon Chang am 10 Apr. 2020
Kommentiert: Sehoon Chang am 12 Apr. 2020
I have outliers at the X-axis position 5785 and 7934.
outliers = 5785; 7934
In order to replace the outlying value, outliers are above mentioned points are deleted and a new 'corrected' values are created.
W(outliers) = []
x = 1:17280 % indices for x asix
x(outliers) = [] % deleting / emptying the value at the outlier position on x-axis
W_int = interp1(x',W, outliers)
How may i inserted the corrected value back in to the previously deleted position?

Akzeptierte Antwort

Tommy
Tommy am 11 Apr. 2020
How about simply
W = filloutliers(W, 'linear');
If you want to supply the outliers yourself:
outliers = [5785; 7934];
x = 1:numel(W);
W = filloutliers(W, 'linear', 'OutlierLocations', any(x==outliers)');
  1 Kommentar
Sehoon Chang
Sehoon Chang am 12 Apr. 2020
thanks alot! you've provided me with a better answer that i was awaiting for

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Curve Fitting Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by