# extracting 20% of the data from a table

조회 수: 1 (최근 30일)
Salma fathi 2022년 6월 14일
댓글: Salma fathi 2022년 6월 15일
i have the following data table that represents the curve that is is shown in the plot, at row number 9 in this table we have the peak point, th max point for the variable NE8, we would like to split our table in a way such that we extract 20% of the data points we have above the peak and 20% of the data below the peak and the peak point from that table? is there an easy way that would allow us to do that ?
thanks in advance

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

### 채택된 답변

KSSV 2022년 6월 14일
T = readtable('https://in.mathworks.com/matlabcentral/answers/uploaded_files/1031740/testProfile.txt') ;
plot(T.NE,T.GDALT)
x = T.NE ;
y = T.GDALT ;
peak_y = T.GDALT(9) ;
peak_x = T.NE(9) ;
% idx = y <= peak_y ;
idx = x <= peak_x ;
plot(x,y,'r',x(idx),y(idx),'*g',x(~idx),y(~idx),'*k')
legend('Curve','below peak','above peak')
##### 댓글 수: 1이전 댓글 -1개 표시이전 댓글 -1개 숨기기
Salma fathi 2022년 6월 15일
Thank you, this was helpful.

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

### 카테고리

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

R2021b

### Community Treasure Hunt

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

Start Hunting!

Translated by