Replacement of Nan to 2.74

3 次查看(过去 30 天)
ali tefeili
ali tefeili 2019-12-29
One of the elements in the usage variable has a value of NaN. Replace this value with the value 2.74.
How can i write this ??
  3 个评论
Sohail Ahmad
Sohail Ahmad 2020-2-20
array-name (Row,Column)=2.74

请先登录,再进行评论。

回答(2 个)

Star Strider
Star Strider 2019-12-29
Use the isnan function to detect it and its location. Since this seems to be a homework problem, I leave the rest to you. (If it is not a homework probllem, I will provide a more detailed Answer.)
  2 个评论
ali tefeili
ali tefeili 2019-12-30
Thankyou,what if i know in which row und column it is ?
Star Strider
Star Strider 2019-12-30
My pleasure.
Use the find function. See the documentation to understand how to get both the row and column indices.

请先登录,再进行评论。


Steven Lord
Steven Lord 2020-2-20
You could use the fillmissing function to fill the location of your missing data (NaN for double and single precision variables) with a constant. It will also allow you to specify different methods to fill that missing data (several types of interpolation, values that are "around" the missing data, or moving average or median.)

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

标签

产品


版本

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by