Replace numbers without using find()

1 view (last 30 days)
timetry2
timetry2 on 11 Oct 2019
Edited: Adam Danz on 11 Oct 2019
I have a code that looks like this: A = randi([100,200],1000,1000)
Is there a code I can use that will replace all numbers between 150 and 200 with Nan without using the find ()?

Accepted Answer

Adam Danz
Adam Danz on 11 Oct 2019
Edited: Adam Danz on 11 Oct 2019
A(A>150 & A<200) = NaN;
I interpret "between" as not inclusive. If you want inclusive,
A(A>=150 & A<=200) = NaN;

More Answers (0)

Categories

Find more on Creating and Concatenating Matrices in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!