How can I deleate or replace with a 0 all the Nan, Inf anf -Inf values in a time series from the biggining to the end?

조회 수: 38 (최근 30일)
Ive got a time series from Simulink that changes its size every time I run the simulation and I want to get rid of all the Nan anf Inf values.
Any idea of how I can do that?

답변 (3개)

madhan ravi
madhan ravi 2019년 9월 21일
편집: madhan ravi 2019년 9월 21일
a(isinf(a)|isnan(a))=0 % replaces with zero

David Hill
David Hill 2019년 9월 21일
A(~isnan(A)&A~=Inf);
  댓글 수: 4

댓글을 달려면 로그인하십시오.


Stephen23
Stephen23 2021년 6월 8일
Simpler:
a(~isfinite(a)) = 0;

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by