Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
特定の条件で行列の値を見つける方法。例えば、
a=[-3.14,2.12,-5,3,6,7]; b=find(a>0)
これは、その ">0" 条件 (b= 2 4 5 6) を持つ行列のインデックスを返します。
b= 2.12 3 6 7 を返すなど、その条件下で行列の実際の値を見つけるための解決策はありますか?
検索部分をスキップすることもできます:
whatyouwant = a(a>0);
これは、Matlab では論理インデックス作成と呼ばれます...
あなたは次のことができます
a = [-3.14,2.12,-5,3,6,7]; b = find(a>0) c = a(b)
次にc、のインデックスに基づいて選択された値になりますb.
c
b.
それが役に立てば幸い!