필터 지우기
필터 지우기

How to count the number of point and know their coordinates in a specified area from a scatter plot

조회 수: 2 (최근 30일)
Hi all,
So, how to o count the number of point and know their coordinates in the specified area (the red area) from the scatter plot? I imported my array from excel, and this is my code below so far....
clf
clear all
clc
load ax
load ay
scatter(ax,ay);
xlabel('xlabel');
ylabel('ylabel');

답변 (2개)

Stijn Haenen
Stijn Haenen 2019년 11월 7일
Hi,
This can be done with:
bx=ax(abs(ay-1.5)<0.2); by=ay(abs(ay-1.5)<0.2);
num_b=numel(bx);

Stijn Haenen
Stijn Haenen 2019년 11월 7일
Sure,
Lets start with a simple example:
x=1:10;
If you want to make an array with all the vallues of x that are for example larger than 5 you can use:
array=x(x>5); --> array = 6,7,8,9,10.
In your example you want all the point that with a y-coordinate between 1.3 and 1.7, in other words around 1.5 +-0.2.
Translating this to my simple example with x=1:10 where the output should be for example between 4 and 8 requires:
output=x(abs(x-6)<=2);

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by