How to get_ride of NaN values in a cell?

1 Ansicht (letzte 30 Tage)
Andi
Andi am 14 Apr. 2022
Kommentiert: Andi am 14 Apr. 2022
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);

Akzeptierte Antwort

Bruno Luong
Bruno Luong am 14 Apr. 2022
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 Kommentar
Andi
Andi am 14 Apr. 2022
I am very gratful to you, this works perfectly.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Tags

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by