replace "inf " with a value
12 次查看(过去 30 天)
显示 更早的评论
hi all. i have a 8192*300 matrix. some of its elements are "inf". i want to replace these values with average of cells before and after them. could you give me an advice? thank you very much
3 个评论
per isakson
2015-2-14
编辑:per isakson
2015-2-14
Replace inf by nan and use inpaint_nans by John D'Errico or Inpaint over missing data in 1-D, 2-D, 3-D,... N-D arrays by Damien Garcia
回答(1 个)
Stephen23
2015-2-14
编辑:Stephen23
2015-2-14
Use TriScatteredInterp or scatteredInterpolant (newer MATLAB versions). You can pass these vectors of your data points excluding the Inf values, and then they will interpolate new points at the grid locations that you specify.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Resizing and Reshaping Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!