フィルターのクリア

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?

17 ビュー (過去 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 件のコメント
David Hill
David Hill 2019 年 9 月 21 日
If you want to replace with 0.
a(isnan(a))=0;
a(a==Inf)=0;

サインインしてコメントする。


Stephen23
Stephen23 2021 年 6 月 8 日
Simpler:
a(~isfinite(a)) = 0;

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by