How to count the frequency of repeated values in an array of values with the index position?

2 ビュー (過去 30 日間)
clc
clear
t=0:.001:10;
y=sin(2*pi*t);
I want to count the frequency of repeated values in 'y' . How can I do that? I also want to print out the index position where value is being repeated.
Thanks!

採用された回答

the cyclist
the cyclist 2019 年 9 月 28 日
You can do both of these things using the unique command.
Be aware, though, that due to accuracy of floating point numbers, you may not get exact repeated values when you expect them.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by