MATLAB Answers

0

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?

Asked by Diego Dranuta on 21 Sep 2019
Latest activity Edited by madhan ravi
on 21 Sep 2019
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?

  0 Comments

Sign in to comment.

2 Answers

Answer by David Hill on 21 Sep 2019

A(~isnan(A)&A~=Inf);

  4 Comments

Show 1 older comment
If you want to replace with 0.
a(isnan(a))=0;
a(a==Inf)=0;

Sign in to comment.


Answer by madhan ravi
on 21 Sep 2019
Edited by madhan ravi
on 21 Sep 2019

a(isinf(a)|isnan(a))=0 % replaces with zero

  0 Comments

Sign in to comment.