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

4 ビュー (過去 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 Center および File ExchangeScatter Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by