How to replace array elements in specified indexes with another array?
古いコメントを表示
Good morning/afternoon/evening, ladies and gentlemen.
A bit of introduction to the problem for your convenience and ease of understanding:
- Imagine I have an array "A", which is 10x1 double. The values are [1; 2; 3; 4; ... 10] with indexes 1, 2, 3 ... 10, respectively.
- To find outliers and I made following array: TF = isoutlier(A). Assume the TF is 5x1 double and it has detected outliers in array "A" with indexes/positions of outliers of [3, 4, 6, 8, 9].
Question:
- How do I delete the array "A" values in indexes mentioned by array "TF" without completely removing indexes - for example A = [1, 2, NaN, NaN, 5, NaN, 7, NaN, NaN, 10]?
- And how do I replace the aforementioned "NaN" values in array "A" with mean values of first available neigbouring values? The example output I'm looking for is following: A = [1, 2, ((2+5)/2), ((2+((2+5)/2))/2), 5, ((5+7)/2), 7, ((7+10)/2), ((7+((7+10)/2))/2), 10]?
- Since I foreshadow that the outlier can be at the end of array, how do I write this into rule explained in question #2? Example A = [1, 2, ... ((7+???)/2)]
I apologise beforehand if the questions are dumb, I am new to this, hence I'm dumb myself. Thank you, kindly, for your assistance and advises.
Best regards,
Mekan
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Multidimensional Arrays についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
