convert array that has NAN to 0

1 vue (au cours des 30 derniers jours)
sri satya ravi
sri satya ravi le 12 Août 2022
Commenté : sri satya ravi le 12 Août 2022
I am having an array of length 1669965*1 double. There are some NAN's in it which are intermixed with the required data.
I am trying the convert NAN's to 0 without changing the length of the array.
Charge_P = Charge_P(isnan(Charge_P))=0;
I am getting an error saying i have to use '==' but if i use it it is modifying the length of my array.

Réponse acceptée

Cris LaPierre
Cris LaPierre le 12 Août 2022
You can't have two assignment operators (the equals sign) in a single command. I think you just want this
Charge_P(isnan(Charge_P))=0;
You might also be insterested in the fillmissing function.
Charge_P = fillmissing(Charge_P,'constant',0)
  1 commentaire
sri satya ravi
sri satya ravi le 12 Août 2022
Thank you.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Tags

Produits


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by