フィルターのクリア

how to ease conditions?

1 回表示 (過去 30 日間)
Ani Asoyan
Ani Asoyan 2020 年 5 月 11 日
コメント済み: Ani Asoyan 2020 年 5 月 11 日
Hi .. In my code I have a result number (called "gov") on which I want to put conditions
also there is a matrix with 25 columns and 5 rows (called "gp") and a parameter "d"
if gov= one of the values of the first 5 colums of gp (doesn't matter which row)
d=d+1
end
how can I write that easily and short, without typing all the rows and colums?

採用された回答

Image Analyst
Image Analyst 2020 年 5 月 11 日
Try ismember()
if ismember(gov, gp(:, 1:5))
d = d + 1;
end
  1 件のコメント
Ani Asoyan
Ani Asoyan 2020 年 5 月 11 日
Thank you so much !

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCharacters and Strings についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by