Fetching x axis Data values and corresponding y data value
조회 수: 1 (최근 30일)
이전 댓글 표시
I have some data in the form
x = [1x72] a matrix which is x axis of the data
y = [1x72] a matrix which is y axis of the data
I am using following code
index = find(x>4 & x<5.1) %to fetch all those x axis data points having values between 4 and 5.1
Which gives me all those columbs numbers having values between 4 and 5.1
But I want the Data i.e. "x" not the columb number. What should I do?
I also want to get the corresponding values of "y" at all those selected x point.
Thanks in advance.
![Screen Shot 2019-03-11 at 10.00.30 PM.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/207965/Screen%20Shot%202019-03-11%20at%2010.00.30%20PM.png)
댓글 수: 0
채택된 답변
KSSV
2019년 3월 12일
To get the y values correspeonding to x:
idx = x >4 & x<5.1 ;
x1 = x(idx) ;
y1 = x(index) ;
% To get others
x2 = x(~idx) ;
y2 = y(~idx) ;
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!