I have two arrays
A = 1 2.576
1 2.822
13 2.679
13 2.786
25 2.653
25 2.596
25 2.565
B= 1 nan
1 nan
1 nan
2 nan
2 nan
2 nan
.. nan
.. nan
13 nan
13 nan
13 nan
14 nan
14 nan
14 nan
.. nan
.. nan
20 nan
20 nan
20 nan
.. nan
.. nan
.. nan
25 nan
25 nan
25 nan
I have to create a third matrix C, which have all variables combined based on first column of B, while putting the values of A into it. The empty element, for which no values of A is available should be filled with nan. Desired output is matrix C.
C = 1 2.576
1 2.822
1 nan
2 nan
2 nan
2 nan
3 nan
3 nan
3 nan
4 nan
4 nan
4 nan
.. nan
.. nan
10 nan
10 nan
10 nan
13 2.679
13 2.786
14 nan
14 nan
14 nan
.. nan
.. nan
20 nan
20 nan
20 nan
25 2.653
25 2.596
25 2.565
I tried with intersect, however, it's not working for this case since the common column contains repeated values. Any help?
0 Comments
Sign in to comment.