I am working on a script which takes in array values and generates a matrix as shown in the code. What I want to do, based on below code, is that I want to search another matrix of given values and find the values corresponding to the cel
and flr
variables as defined in the program and make a new row to the matrix.
This is the current output:
C =
63.6944 51.7205 -38.2795 -39.0000 -38.0000 B value correspond to -39
107.5034 68.4665 -21.5335 -22.0000 -21.0000 B value correspond to -22
155.1031 75.2618 -14.7382 -15.0000 -14.0000 B value correspond to -15
203.8553 78.8393 -11.1607 -12.0000 -11.0000
253.0948 81.0307 -8.9693 -9.0000 -8.0000
302.5838 82.5070 -7.4930 -8.0000 -7.0000
352.2172 83.5677 -6.4323 -7.0000 -6.0000
401.9415 84.3662 -5.6338 -6.0000 -5.0000
to above I want to add another column which is searching corresponding values in given matrix say -39
, -22
, -15
, 12
, -9
, -8
, -7
, -6
will be searched in a 2D matrix say B
which is below. Now I want another column in below matrix which shows corresponding values of the matrix B
in A
.
B = [-39 14
-38 12
-15 10
-12 17
-9 45
-8 16]
a = 1;
for X = [50 100 150 200 250 300 350 400]
R = hypot(41.4586-2, X);
theta = atand(X/(41.4586-2));
dep = theta-90;
flr = floor(dep);
Y(row1:col1) = find(Y==flr);
dB1 = Y(row1:2);
cel = ceil(dep);
Y(row2,col2) = find(Y==cel);
dB2= Y(row2:2);
A(1,a) = R;
A(2,a) = theta;
A(3,a) = dep;
A(4,a) = flr;
A(5,a) = cel;
A(6,a) = dB1;
a = a+1;
end
C = transpose(A);