Replace numbers without using find()

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 ()?

 采纳的回答

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

更多回答(0 个)

类别

帮助中心File Exchange 中查找有关 NaNs 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by