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.

 채택된 답변

Cris LaPierre
Cris LaPierre 2022년 8월 12일

0 개 추천

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)

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Data Type Conversion에 대해 자세히 알아보기

제품

릴리스

R2022a

태그

질문:

2022년 8월 12일

댓글:

2022년 8월 12일

Community Treasure Hunt

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

Start Hunting!

Translated by