How can I mark specific indexes on a plot?

조회 수: 21 (최근 30일)
Serhat Sayim
Serhat Sayim 2020년 12월 6일
댓글: Serhat Sayim 2020년 12월 7일
I have file with the breathing of sick people. These breathing sounds have wheezes in it. I had the plot drawn. I also have the start and end indexes of wheezing. How can I mark these indexes on the plot?

답변 (2개)

KSSV
KSSV 2020년 12월 6일
If (x,y) is your data and id1 and id2 are the indices. Use:
plot(x,y,'b')
hold on
id = [id1 id2] ;
plot(x(id),y(id),'*r')

Steven Lord
Steven Lord 2020년 12월 6일
편집: Steven Lord 2020년 12월 6일
You could use the MarkerIndices property of the line object returned by plot or you could use xline depending on how you want those points marked.
x = 0:360;
y = sind(x);
plot(x, y, 'ro-','MarkerIndices', (0:45:360)+1)
figure
plot(x, y, 'r-')
for multiplesOf45 = 0:45:360
xline(multiplesOf45)
end
  댓글 수: 1
Serhat Sayim
Serhat Sayim 2020년 12월 7일
My plot is this. For example first wheeze starting at 1063 and end at 7952. My question is how can I mark points 1063 and 7952 only? These indexes are only in x axis .The region between this indexes will give me the wheezing of an patient. Can you help me with this?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by