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 CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by