How to get_ride of NaN values in a cell?

1 visualización (últimos 30 días)
Andi
Andi el 14 de Abr. de 2022
Comentada: Andi el 14 de Abr. de 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);

Respuesta aceptada

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

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Logical en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by