Selecting two data points form plot
1 view (last 30 days)
Show older comments
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](https://www.mathworks.com/matlabcentral/answers/uploaded_files/253170/untitled.jpeg)
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.
0 Comments
Answers (0)
See Also
Categories
Find more on Explore and Edit Images with Image Viewer App in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!