how to re-insert elements into a vector
조회 수: 1 (최근 30일)
이전 댓글 표시
I have outliers at the X-axis position 5785 and 7934.
outliers = 5785; 7934
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/283507/image.png)
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?
댓글 수: 0
채택된 답변
Tommy
2020년 4월 11일
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)');
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Curve Fitting Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!