Data Extraction using ginput
조회 수: 2 (최근 30일)
이전 댓글 표시
Hello Everyone,
Happy new Year! To begin with. My question is i am using ginput and trying to acquire data of a plot. But the issue i am facing is when i try to aquire data between two selected points it gives me data through out the plot where the (find data points) condition is met rather then just between the selected points. Any help would be appreciated. Have attached my code, data file and also the figure for better understanding.
Thanks
Anand
[filename,pathname] = uigetfile('*.xlsx');
fullfilename = fullfile(pathname,filename);
A = xlsread(fullfilename);
Torque = movmean(A(:,1 ),50);
Angle = movmean(A(:,2),50);
plot(Torque);
[a,b] = ginput(2);
str1 = b(1);
fin1 = b(2);
i = find(Torque > str1 & Torque < fin1);
Torque1 = Torque(i);
Angle1 = Angle(i);
T = table(Torque1,Angle1);
채택된 답변
Image Analyst
2019년 1월 1일
Maybe you mean:
startingIndex = a(1);
endingIndex = a(2);
x = 1 : length(Torque);
mask = find(x >= startingIndex & x < endingIndex);
Torque1 = Torque(mask);
Angle1 = Angle(mask);
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Data Exploration에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!