Changing values in 2D array using logical operators

2 ビュー (過去 30 日間)
Bob
Bob 2012 年 7 月 18 日
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:
aa=rand(10,10);
ab(aa<0.5)=nan;
ab is now a 1x100 row vector - how can I perform the operation but maintain the 2D array?

採用された回答

Sebastian Holmqvist
Sebastian Holmqvist 2012 年 7 月 18 日
aa = rand(10, 10);
aa(aa < 0.5) = NaN;
  1 件のコメント
Bob
Bob 2012 年 7 月 18 日
:facepalm:
Thanks!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by