필터 지우기
필터 지우기

How to find the index of the first repeating value.

조회 수: 1 (최근 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 CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by