function to fill in zeros
显示 更早的评论
Hello! I have an array of data where there are zeros and I need to replace them. How can I do this?
data=[100 95 0 90 0 85 0 0 70 65 ] % as it is
data=[100 95 92.5 90 87.5 85 ] % and so it is necessary
is there a special function in matlab for this?
5 个评论
madhan ravi
2019-9-2
What happened to 0 0 70 65 ??
Lev Mihailov
2019-9-2
madhan ravi
2019-9-2
Provide the complete result for the example provided above, instead of keeping it as a mystery after someone answers.
Lev Mihailov
2019-9-2
Adam
2019-9-2
I'm guessing you want to replace 0s with the mean of the values either side of them, but as madhan ravi says, if you cut off a fundamental part of the example it's impossible to know. Replacing individual zeros with the mean of values either side is easy. Replacing zeros when you get multiple of them in a row is a little less clearly defined.
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 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!