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.
1 次查看(过去 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!