필터 지우기
필터 지우기

Finding location of specific element from a MATRIX returns '0×1 empty double column vector'

조회 수: 8 (최근 30일)
Hi everyone,
I have a matrix and I'm trying to find location of some specific elements but it gives me no answer. My code:
[i,j] = find(a==23.5975) % it can be clearly seen in the figure that this value is present in the
% 1st row and 3rd column. but it gives the following result.
i =
0×1 empty double column vector
j =
0×1 empty double column vector
I'll be gratefu for any help, thank you.

채택된 답변

Chunru
Chunru 2021년 9월 23일
[i,j] = find(abs(a-23.5975)<1e-20)
  댓글 수: 7
Walter Roberson
Walter Roberson 2021년 9월 23일
target = 0.1863
target = 0.1863
rng(1);
a = rand(4)
a = 4×4
0.4170 0.1468 0.3968 0.2045 0.7203 0.0923 0.5388 0.8781 0.0001 0.1863 0.4192 0.0274 0.3023 0.3456 0.6852 0.6705
[found, idx] = ismembertol(target, a)
found = logical
0
idx = 0
[~, minidx] = min(abs(target - a(:)));
a(minidx)
ans = 0.1863
a(minidx) - target
ans = -3.9789e-05
[found, idx] = ismembertol(target, a, 1e-4)
found = logical
1
idx = 7

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Detection에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by