finding the closest value
이전 댓글 표시
I am working with a very large data set, in which I need to pull numbers from 1 data set that corresponds with a different set. But, if no number from the first data table match the second, then it pulls the next highest number from the second data set.
댓글 수: 2
David Hill
2022년 9월 8일
Do all numbers in the first data set need a corresponding number from the other data set (either a match or the next largest)?
jason
2022년 9월 8일
채택된 답변
추가 답변 (1개)
David Hill
2022년 9월 8일
data3=data1;
S=sort(data2);
idx= find(~ismember(data1,data2));
for k=idx
f=find(S>data1(k),1);
data3(k)=S(f);
end
카테고리
도움말 센터 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!