creating an empty cell in an array

7 Ansichten (letzte 30 Tage)
Ahmed Abdulla
Ahmed Abdulla am 21 Jun. 2019
Kommentiert: Akshay Malav am 21 Jun. 2019
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 Kommentare
madhan ravi
madhan ravi am 21 Jun. 2019
Can’t you just ignore NaN values using isnan() ?
madhan ravi
madhan ravi am 21 Jun. 2019
a = [1,2,NaN,5,NaN]
b = [3,4,5,1,NaN]
result = ???

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Akshay Malav
Akshay Malav am 21 Jun. 2019
Bearbeitet: Akshay Malav am 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 Kommentare
Ahmed Abdulla
Ahmed Abdulla am 21 Jun. 2019
the problem with this is that im plotting 2 different arrays where Nan in one array might be an actual value on the other so this will make the data miss match
Akshay Malav
Akshay Malav am 21 Jun. 2019
Then you can ignore the corresponding values in the second array .

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Line Plots finden Sie in Help Center und File Exchange

Produkte


Version

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by