find is not matching a value of 1 in an array
조회 수: 3 (최근 30일)
이전 댓글 표시
I am unable to match a value of 1 with find when checking an array produced by linspace. Is this as expected behavior?
% Create our k samples.
k = linspace(0.1, 2.0, 20)
% Find indexes.
[find(k==0.5) find(k==1.0) find(k==1.5)]
댓글 수: 0
채택된 답변
추가 답변 (1개)
Loren Shure
2020년 3월 19일
You are running into an issue of floating point arithmetic. You might use ismembertol : mathworks.com/help/matlab/ref/ismembertol.html
참고 항목
카테고리
Help Center 및 File Exchange에서 Signal Analysis에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!