MATLAB Answers

Replacement of Nan to 2.74

40 views (last 30 days)
ali tefeili
ali tefeili on 29 Dec 2019
Commented: Rasim Tawfeeq on 27 May 2020 at 11:51
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 Comments

Sohail Ahmad
Sohail Ahmad on 20 Feb 2020
Visit this site and go to part 5
Indexing into and Modifying Arrays Use indexing to extract and modify rows, columns, and elements of MATLAB arrays.
  • Indexing into Arrays
  • Extracting Multiple Elements
  • Changing Values in Arrays
Sohail Ahmad
Sohail Ahmad on 20 Feb 2020
array-name (Row,Column)=2.74
Rasim Tawfeeq
Rasim Tawfeeq on 27 May 2020 at 11:51
usage (2,3)=2.74

Sign in to comment.

Answers (2)

Star Strider
Star Strider on 29 Dec 2019
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 Comments

ali tefeili
ali tefeili on 30 Dec 2019
Thankyou,what if i know in which row und column it is ?
Star Strider
Star Strider on 30 Dec 2019
My pleasure.
Use the find function. See the documentation to understand how to get both the row and column indices.

Sign in to comment.


Steven Lord
Steven Lord on 20 Feb 2020
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 Comments

Sign in to comment.

Sign in to answer this question.

Tags

Products


Release

R2019b