How can I automatically select two points in a plot?
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hello,
How can I automatically select two points in a plot?
I use ginput manually, but I want to automate the selection.
You can see part of the code below:
x = (1:length(compositfilt));
y = compositfilt;
hold on
grid on
xlabel('time [s]');
ylabel('voltage');
plot(x,y)
[cut1, ~] = ginput(2);
cut1 = round(cut1);
compositfilt = compositfilt(:,cut1(1):cut1(2));
clf
x = (1:length(compositfilt));
y = compositfilt;
plot(x , y)
0 Commenti
Risposte (1)
Cameron B
il 13 Gen 2020
Select them as in producing data tips? If that's the case, then see the code below. If not, then please explain what you'd like a little bit more.
xx = 1:1:30;
yy = sqrt(xx);
fig = figure;
figplot = plot(xx,yy);
CursorPt1 = createDatatip(datacursormode(fig),figplot);
CursorPt2 = createDatatip(datacursormode(fig),figplot);
CursorPt1.Marker = 'o';
CursorPt2.Marker = 'o';
CursorPt1.MarkerSize = 5;
CursorPt2.MarkerSize = 5;
CursorPt1.Position = [xx(3),yy(3)];
CursorPt2.Position = [xx(6),yy(6)];
0 Commenti
Vedere anche
Categorie
Scopri di più su Data Exploration in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!