How to count the number of point and know their coordinates in a specified area from a scatter plot
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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');
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/247220/image.png)
0 commentaires
Réponses (2)
Stijn Haenen
le 7 Nov 2019
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
le 7 Nov 2019
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);
0 commentaires
Voir également
Catégories
En savoir plus sur Scatter Plots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!