Selecting two data points form plot

2 vues (au cours des 30 derniers jours)
saravanakumar D
saravanakumar D le 6 Déc 2019
clear all;
%% Loading the data and assigning the variable
load('_ Mix 0% .mat')
X1=x{1,1};
R1=r{1,1};
P1=phi{1,1};
%% Plotting
figure(1)
subplot(2,1,1)
plot(X1,R1,'LineWidth',2)
subplot(2,1,2)
plot(X1,P1,'LineWidth',2)
%% Selecting the range of data from X1 through clicking the plot using mouse
%[rx,ry]=ginput(2);
[xi,yi] = getpts(X1)
idx1=find(X1==rx(1));
untitled.jpg
My plot looks like above. I would like to truncate the vector such that is contains values from 300 to 600. where as in X1 doesn't contain 300 instead it has 300.2454 . I would like to write a genralized code where I can click on plot to record two data points from X1 (xdata).
[x,y] = getinput(2) returned vales are not from the vector i plotted.
[x,y] = getpts(X1) it is returning vector full of zeros. It should work occording to the manual.
rect = getrect(X1) This one also not working
Somebody please help me.

Réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by