How to get_ride of NaN values in a cell?

1 回表示 (過去 30 日間)
Andi
Andi 2022 年 4 月 14 日
コメント済み: Andi 2022 年 4 月 14 日
Hi everyone,
I have two dataset and need to scareen second set for each value fo the first set using its upper and lower bound. Either there be some value in teh upper and lower bound or zero. But, the output include NaN values as a count (Earlier, I post this question, but still unable to fix this).
Data and script as follows:
clear all
clc
data1=readmatrix('data1.csv'); % selected candidate earthquake
ev_time=datenum(data1(:,1),data1(:,2),data1(:,3),data1(:,4),data1(:,5),data1(:,6));
cand_ev=ev_time';
for jj=1:194
b=cand_ev(:,jj);
aa(jj)= addtodate(b, 30, 'day');
bb(jj)= addtodate(b, -30, 'day');
end
U_lim=aa;
L_lim=bb;
a=load('selected_0.01.csv');
for kk=1:194
for ii=1:10
e{ii, kk}=a(a(:, ii)>L_lim(:,kk) & a(:,ii)<U_lim(:, kk));
end
end
%ee=e>0;
count = cellfun(@numel, e);
nc = sum(count>=10);

採用された回答

Bruno Luong
Bruno Luong 2022 年 4 月 14 日
IMH this is correct statement inside the double for-loop
e{ii, kk}=a(a(:, ii)>L_lim(:,kk) & a(:,ii)<U_lim(:, kk), ii);
  1 件のコメント
Andi
Andi 2022 年 4 月 14 日
I am very gratful to you, this works perfectly.

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

その他の回答 (0 件)

カテゴリ

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

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by