Weird Behavior Of Replacing Data Array In a Certain Range ...

1 view (last 30 days)
Tyann Hardyn
Tyann Hardyn on 18 Dec 2021
Edited: Tyann Hardyn on 21 Dec 2021
Hi, Community
I want to ask about how to delete array data with a certain range. So i have this code below :
the_noising_gauss_ori = vertcat(transpose(noising_gauss_ori)); %Other related variable was sucessfully linked
mov_remove_gauss_ori_pos = the_noising_gauss_ori >= 2; %Other related variable was sucessfully linked
mov_remove_gauss_ori_neg = the_noising_gauss_ori <= -2; %Other related variable was sucessfully linked
detecting_noise_pos = the_noising_gauss_ori < 2; %Other related variable was sucessfully linked
detecting_noise_neg = the_noising_gauss_ori > -2; %Other related variable was sucessfully linked
gaussian_filter = imgaussian(graph_gauss_ori, zigm, [l_wak 1]); %Other related variable was sucessfully linked
if ~isempty(mov_remove_gauss_ori_neg) || ~isempty(mov_remove_gauss_ori_neg)
the_original_sinyal2(detecting_noise_pos) = nan;
the_original_sinyal2(detecting_noise_neg) = nan;
the_original_sinyal1(mov_remove_gauss_ori_pos) = gaussian_filter(mov_remove_gauss_ori_pos);
the_original_sinyal1(mov_remove_gauss_ori_neg) = gaussian_filter(mov_remove_gauss_ori_neg);
end
When i run that code, the variable array of the_original_sinyal1(mov_remove_gauss_ori_pos) and the_original_sinyal1(mov_remove_gauss_ori_neg) is good, it can be replaced with its relative data from gaussian_filter(mov_remove_gauss_ori_pos) and gaussian_filter(mov_remove_gauss_ori_neg).... How ever, the variable array of the_original_sinyal2(detecting_noise_pos) and the_original_sinyal2(detecting_noise_neg) cannot filter the data with that range (the_noising_gauss_ori < 2 or the_noising_gauss_ori > -2) and just shown as NaN data for all of the_original_sinyal2 variable....
How to fix my problem, anyone. I just want to replace the_original_sinyal2 variable with a same rows as the_noising_gauss_ori < 2 or the_noising_gauss_ori > -2 as NaN.... Thank you very much...

Accepted Answer

Voss
Voss on 18 Dec 2021
Edited: Voss on 18 Dec 2021
Any (real) number is either less than 2 or greater than -2 (or both). Therefore detecting_noise_pos | detecting_noise_neg is all true. Hence, the_original_sinyal2 is all NaN after doing this:
the_original_sinyal2(detecting_noise_pos) = nan;
the_original_sinyal2(detecting_noise_neg) = nan;
  6 Comments

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!