Finding location of specific element from a MATRIX returns '0×1 empty double column vector'
8 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/747299/image.jpeg)
I'll be gratefu for any help, thank you.
0 Kommentare
Akzeptierte Antwort
Chunru
am 23 Sep. 2021
[i,j] = find(abs(a-23.5975)<1e-20)
7 Kommentare
Walter Roberson
am 23 Sep. 2021
target = 0.1863
rng(1);
a = rand(4)
[found, idx] = ismembertol(target, a)
[~, minidx] = min(abs(target - a(:)));
a(minidx)
a(minidx) - target
[found, idx] = ismembertol(target, a, 1e-4)
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Detection finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!