hello everyone. How to divide a group of points named data into two parts, dataA and dataB, as shown in the figure. Thank you very much.
조회 수: 2 (최근 30일)
이전 댓글 표시
채택된 답변
추가 답변 (1개)
KSSV
2021년 6월 2일
x = data(:,1) ;
y = data(:,2) ;
mx = mean(x) ; my = mean(y) ;
idx = y < my ;
x1 = x(idx) ; y1 = y(idx) ;
x2 = x(~idx) ; y2 = y(~idx) ;
plot(x,y,'.r')
hold on
plot(mx,my,'*b')
plot(x1,y1,'.b')
plot(x2,y2,'.g')
참고 항목
카테고리
Help Center 및 File Exchange에서 Other Formats에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!