2 comparisons in find(...)
1 次查看(过去 30 天)
显示 更早的评论
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?
0 个评论
采纳的回答
更多回答(1 个)
Andrei Bobrov
2012-4-19
t = Sig_log(:,1:2)*[2;1];
out = find(t > 1 & t < 3)
2 个评论
Walter Roberson
2012-4-19
Using the temporary variable will use *much* less memory than your proposed solution.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Search Path 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!