How to count the number of point and know their coordinates in a specified area from a scatter plot
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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');
0 Kommentare
Antworten (2)
Stijn Haenen
am 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);
2 Kommentare
Stijn Haenen
am 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 Kommentare
Siehe auch
Kategorien
Mehr zu Scatter Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!