フィルターのクリア

How to find the index of the first repeating value.

4 ビュー (過去 30 日間)
Vahram Voskerchyan
Vahram Voskerchyan 2022 年 6 月 23 日
編集済み: Voss 2022 年 6 月 23 日
I want to find the index of the first repeating value and plot a vertical line at that point, when the graph stabilizes.
a = [1,2,3,4,5,6,7,8,8,8,8,8,8,8,8,8,8,8,8]
b = linspace(0, 10, length(a));
plot(a,b)
%xline(b) exactly at the location where the values repeat in a.

採用された回答

Voss
Voss 2022 年 6 月 23 日
編集済み: Voss 2022 年 6 月 23 日
a = [1,2,3,4,5,6,7,8,8,8,8,8,8,8,8,8,8,8,8];
b = linspace(0, 10, length(a));
% plot(a,b)
plot(b,a)
idx = find(diff(a) == 0, 1)
idx = 8
xline(b(idx))
ylim([0 10])

その他の回答 (0 件)

カテゴリ

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

タグ

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by