Suppose you have a 2d matrix M. And you have certain indexes where the data is not good.SO you want to fill those indexes by the nearest existing value.Can regionfill be used for this
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
MSP
am 18 Jul. 2017
Beantwortet: Sebastian Castro
am 18 Jul. 2017
M=magic(10)
index=[7,8,,5,9,45,43,23,34]
M(index)=nan
Now how to fill up those Nan values such that it contains the nearest existing value
AND
second average of nearest existing values
0 Kommentare
Akzeptierte Antwort
Sebastian Castro
am 18 Jul. 2017
>> x = [7,8,NaN,5,9,45,43,23,34,NaN,NaN,100]
x =
7 8 NaN 5 9 45 43 23 34 NaN NaN 100
>> fillmissing(x,'nearest')
ans =
7 8 5 5 9 45 43 23 34 34 100 100
>> fillmissing(x,'linear')
ans =
7.0000 8.0000 6.5000 5.0000 9.0000 45.0000 43.0000 23.0000 34.0000 56.0000 78.0000 100.0000
- Sebastian
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu MATLAB Compiler 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!