How do you use the find function to look for 2 different values?

7 ビュー (過去 30 日間)
Dave
Dave 2013 年 5 月 5 日
This may sound really simple but I'm pretty new to Matlab and strolling through the product help and forums hasn't provided any solutions. Im looking for a way to return just the row numbers of when in the column the numbers 2 and 4 appear. Ive tried using:
CMJ = find(data(:,2)==2 & data(:,2)==4);
but im just getting an empty array. any suggestions would be greatly appreciated!

回答 (1 件)

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 5 月 5 日
編集済み: Azzi Abdelmalek 2013 年 5 月 5 日
Maybe you are looking for
CMJ = find(data(:,2)==2 | data(:,2)==4);
In column 2, you can not have 2 and 4 at the same time

カテゴリ

Help Center および File ExchangeVibration Analysis についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by