how to find the index?
조회 수: 3 (최근 30일)
이전 댓글 표시
Hi all,
I am facing a trouble in extracting the indecies from the 3rd dimension of matrix using 'find' function.
for example : time is 251 * 28 * 20, where 20 is the time.
index = find(time>=datenum(2019,02,01)& time<=datenum(2019,02,07));
any help will be apprecited
댓글 수: 0
채택된 답변
Ameer Hamza
2020년 11월 5일
편집: Ameer Hamza
2020년 11월 5일
By default, find() return linear indexes. To convert them to the dimension subscripts, you ind2sub()
index = find(time>=datenum(2019,02,01)& time<=datenum(2019,02,07));
[r, c, p] = ind2sub(size(time), index)
'p' is location in 3rd dimension.
댓글 수: 5
Ameer Hamza
2020년 11월 5일
I don't get empty output on running this code. The output on my system is attached.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!