Data Extraction using ginput

7 ビュー (過去 30 日間)
Sai Gudlur
Sai Gudlur 2019 年 1 月 1 日
コメント済み: madhan ravi 2019 年 1 月 2 日
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);
ginput_Plot.jpg
  1 件のコメント
madhan ravi
madhan ravi 2019 年 1 月 1 日
編集済み: madhan ravi 2019 年 1 月 1 日
getpts()?

サインインしてコメントする。

採用された回答

Image Analyst
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);
  2 件のコメント
Sai Gudlur
Sai Gudlur 2019 年 1 月 1 日
Thanks a lot. Learnt my mistake was i wasn't assigning it to variable x which count of Torque and then have it index.
madhan ravi
madhan ravi 2019 年 1 月 2 日
+1 , 50000 points reached!!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAuthor Block Masks についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by