using ismember to find the corresponding value
조회 수: 1 (최근 30일)
이전 댓글 표시
clear all
depth = [0,2,4,7,10,13,16,19,22,25,30,35];%depth below surface
temp = 0 + 29.*rand(365,12);
metaT = 0 + 35.*rand(365,1);
[Lia,Locb] = ismember(round(metaT),depth);
In this example I use ismember to find the column number of 'depth' which 'metaT' corresponds to. The only problem is that the values do not equal exactly the same as those specified in depth, therefore without inserting the round command, ismember would return a vector of zeros. I was wondering if there was another method of doing this, such as if the value doesn't equal that of depth, say if metaT had a value of 20 it would correspond to the values of 19 or 22 in the depth vector. So, basically find within which range of depth it corresponds to, and then rounds it to the closest value.
댓글 수: 0
채택된 답변
Sean de Wolski
2012년 3월 8일
doc histc
where depth is your edges.
The 2nd output argument will be the one you care about most likely.
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Annotations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!