Consider 2 matrices A,B where A is 21x2 matrix and B is 35x3 matrix
A = [ 1 2 ; B = [ 1 2 3 ;
1 3 ; 1 2 4 ;
1 4 ; .
. .
. .
. 5 6 7]
6 7 ]
And I have vectors count_A
and count_B
:
count_A
is a21 x 1
vector which has a scalar corressponding to each row ofA
- Similarily,
count_B
is35 x 1
vector.
I need to scan through B
and find the ratio count_B/count_A
which reads the first 2 elements of each row of B
and calls its corresponding count from count_A
. We also need to get the count_B
value for that row and gives the ratio for every row in B
.
Example:
count_A = [ 2 ; count_B = [ 1 ;
3 ; 2 ;
. .
. .
. .
2 ] 3 ]
Outputs should be as follows:
first row:
count([1,2,3]) / count([1,2])
which would be1/2
second row:
count([1,2,4]) / count([1,2])
which would be2/2
=1
....
35th row:
count([5,6,7]) / count([5,6])
And what I mean by count([1,2,3])
is count_B
coressponding to [1,2,3]
and count([1,2])
is the value of count_A
coressponding to [1,2]
.
Any ideas?