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?

37 次查看(过去 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