Changing values in 2D array using logical operators

4 Ansichten (letzte 30 Tage)
Bob am 18 Jul. 2012
I'm sure I've solved this before, but it's befuddled me today.
I have a 2D array and I want to subselect some values and set them to nan:
ab is now a 1x100 row vector - how can I perform the operation but maintain the 2D array?

Akzeptierte Antwort

Sebastian Holmqvist
Sebastian Holmqvist am 18 Jul. 2012
aa = rand(10, 10);
aa(aa < 0.5) = NaN;

Weitere Antworten (0)


Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange


Community Treasure Hunt

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

Start Hunting!

Translated by