How do I select specific data?
조회 수: 38 (최근 30일)
이전 댓글 표시
Hi I am new to Matlab and I'm trying to get my feet on the ground here.
I have 2 columns of data and but I only want to select data in column 2 for a given number of rows which I have defined using
> find(time<5)
where time is the number of the variable in column 1.
This has given me the row numbers for all the data I want, Now I was just wandering how I select the data in column 2 for these row numbers?
Thanks
댓글 수: 0
답변 (4개)
Star Strider
2016년 10월 21일
If your (Nx2) array is called ‘data’:
ExtractedData = data(find(time<5),2);
should work.
댓글 수: 0
Pico Technology
2016년 10월 21일
Hi Charlie,
You can index a matrix using the row column indices - matrix dimensions are defined as number of rows x number of columns. The following article should help:
If r is the rows i.e.
r = find(time<5)
then you can extract the data from your 2nd column as follows (assuming x is the matrix)
y = x(r, 2);
Hope this helps.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!