Hi I have three dissimilar size array which I am retrieving through a loop, in which the first column contains year and the second column contains value in the next column. I want to concatenate all three sub-matrices based on the year value on the first column. For example, the three matrix A, B and C are as below. The desired output matrix is D.
A = [1950 0.463 1951 0.417 1952 0.468 1953 0.599 1954 0.582 1955 0.518 1956 0.400 1957 0.569 1958 0.498 1959 0.588]B = [1955 0.5671956 0.4941957 0.6361958 0.5341959 0.674]C = [1949 0.68481950 0.64081951 0.59761952 0.61631953 0.73351954 0.70581955 0.65931956 0.56011957 0.69011958 0.60561959 0.7390]The desired matrix is D:D = [1949 Nan 0.6848 Nan 1950 0.463 0.6408 Nan 1951 0.417 0.5976 Nan 1952 0.468 0.6163 Nan 1953 0.599 0.7335 Nan 1954 0.582 0.7058 Nan 1955 0.518 0.6593 0.567 1956 0.4 0.5601 0.494 1957 0.569 0.6901 0.636 1958 0.498 0.6056 0.534 1959 0.588 0.739 0.674]
How can I concatenate them based on the year value on the first column? Any help would be appreciable. Thanks
Best Answer