|
prabhu
I'm not exactly sure what you're doing with your code, but in general
to find "all the b(i,j) values in 'm' " you'd do something like this
% Create sample data.
b = [100.1, 200.2, 300.3; 402.1, 89.9 42.05]
m = [100, 200.2, 300.2,; 400, 89, 42]
% Extract out "matches"
yourTolerance = 0.15;
b_in_m = b(abs(m-b) < yourTolerance)
You use a tolerance because you're comparing floating point numbers.
In your case, you might use something small like eps or some multiple
of it.
You can also take a look at intersect() or ismember() but keep in mind
this (from the FAQ):
http://matlabwiki.mathworks.com/MATLAB_FAQ#Why_is_0.3-0.2-0.1_not_equal_to_zero_.28or_similar.29.3F
b =
100.1000 200.2000 300.3000
402.1000 89.9000 42.0500
m =
100.0000 200.2000 300.2000
400.0000 89.0000 42.0000
b_in_m =
100.1000
200.2000
300.3000
42.0500
|