Selecting two data points form plot

조회 수: 2 (최근 30일)
saravanakumar D
saravanakumar D 2019년 12월 6일
편집: saravanakumar D 2019년 12월 6일
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.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Explore and Edit Images with Image Viewer App에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by