フィルターのクリア

2 comparisons in find(...)

2 ビュー (過去 30 日間)
geieraffe
geieraffe 2012 年 4 月 19 日
Hey there, here's my problem:
with
find( 3> ( 2*Sig_log(:,1) + Sig_log(:,2) ) >1)
I try to get the idx, where the first signal is 1 and the second is 0. (bothsignals are logical)
With just one comparison it works:
find( ( 2*Sig_log(:,1) + Sig_log(:,2) ) >1)
this is how i get the idx where both signals are 1.
i know, if-requests i do with && or , but it doesn't work here.
any ideas?

採用された回答

geieraffe
geieraffe 2012 年 4 月 19 日
it works fine with
find( (2*Sig_log(:,1)+Sig_log(:,2)>1) & (2*Sig_log(:,1)+Sig_log(:,2)<3) )
just take & instead of &&
another solution (works only if you have exact logical signals):
find( ( (2*compSig_log(:,1)+compSig_log(:,2) ) == 2) )

その他の回答 (1 件)

Andrei Bobrov
Andrei Bobrov 2012 年 4 月 19 日
t = Sig_log(:,1:2)*[2;1];
out = find(t > 1 & t < 3)
  2 件のコメント
geieraffe
geieraffe 2012 年 4 月 19 日
close!
but because of my big datasets i dont want to get another variable t.
its some thing like 7000000x1 double ... i had a solution with an extra variable too ...
... but you gave me the right idea!
Walter Roberson
Walter Roberson 2012 年 4 月 19 日
Using the temporary variable will use *much* less memory than your proposed solution.

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

カテゴリ

Help Center および File ExchangeDescriptive Statistics についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by