フィルターのクリア

Check if there are repeated elements in a vector

45 ビュー (過去 30 日間)
Max
Max 2012 年 12 月 4 日
コメント済み: Image Analyst 2021 年 11 月 25 日
Hi to all, is there a command to check if there are repeated elements in a vector; I just have to check in an "if"...
thanks a lot
Max

採用された回答

Image Analyst
Image Analyst 2012 年 12 月 4 日
if length(v) == length(unique(v))
% There are no repeats.
.......
  6 件のコメント
Yasir Iqbal
Yasir Iqbal 2021 年 11 月 25 日
You can simply craete a copy of the vector with the required amount of values. There can be other ways around also. Just a suggestion.
Image Analyst
Image Analyst 2021 年 11 月 25 日
@Larissa Monjaraz I don't understand because you forgot to provide your example with actual numbers. So about all I can say is to try ismember().

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeOperators and Elementary Operations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by