I need to create a bin list in which I test a datetime list against another datetime list of different sizes. Basically, I have a bigger list (tb_date - 81504 samples) and want to know where some days (smaller list - (useful_date - 42443 samples)) are located at it - returning zero if the date is not present in the smaller list, and 1 if it is present. I have made:
[m,n] = size(tb_date);
[i,j] = size(useful_date);
tb_useful_ind = []
for k = 1:n
for i = 1:j
if tb_date(k) == useful_date(j)
tb_useful_ind(k) = 1;
else
tb_useful_ind(k) = 0;
end
end
end
and then, to return the indexes in the tb_date:
date_indexes = find(tb_useful_ind);
I don't know if I am doing it correctly once I am running the code and it is running forever in my computer and I am not even sure i am doing it right.. Is this right? is there any other way I can do it faster?
Thank you very much.
Aucun commentaire:
Enregistrer un commentaire