How to find same values in an array and their index
1 回表示 (過去 30 日間)
古いコメントを表示
Hi,
I have array with some repeated values. I have 1e-6 repeatedly. How can I have find all the values and their corresponding index?
0 件のコメント
回答 (1 件)
Dyuman Joshi
2023 年 11 月 13 日
移動済み: Dyuman Joshi
2023 年 11 月 13 日
arr = load('array.mat')
mat = arr.yintercept
val = 1e-6;
%As you are dealing with floating point numbers, use tolerance to compare
[r, c] = find(abs(mat-val)<1e-9)
参考
カテゴリ
Help Center および File Exchange で Matrix Indexing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!