- Indexing into Arrays
- Extracting Multiple Elements
- Changing Values in Arrays
Replacement of Nan to 2.74
3 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (2 件)
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 件のコメント
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
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.)
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Matrix Indexing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!