creating an empty cell in an array

10 views (last 30 days)
i have an array most made up of numbers and some are NaN i would like to make the NaN cells empty because i have a plotting function that doesnt accept NaN and when i assign it to 0 it affects the resulting graph, so im not really sure of how to make it blank with no numerical value
  4 Comments
madhan ravi
madhan ravi on 21 Jun 2019
a = [1,2,NaN,5,NaN]
b = [3,4,5,1,NaN]
result = ???

Sign in to comment.

Accepted Answer

Akshay Malav
Akshay Malav on 21 Jun 2019
Edited: Akshay Malav on 21 Jun 2019
Then use this code.
A = [1 NaN 2];
B = rmmissing(A) % will remove NaN from array A
The B array wil be [1 2]
  2 Comments
Akshay Malav
Akshay Malav on 21 Jun 2019
Then you can ignore the corresponding values in the second array .

Sign in to comment.

More Answers (0)

Products


Release

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by