Info

This question is closed. Reopen it to edit or answer.

Combine datasets with unequal lengths by matching elements of their first column

2 views (last 30 days)
My question has 3 main sub-questions:
I have 10 matrices (10 different variables: V1, V2, V3…, V10) that each one has 2 or 3 columns and a few hundreds of rows. They all have different sizes. The first column at every matrix is the date, in serial date number, the second is sea depth and the third are values of measured variables (temperature, chlorophyll, etc).
1. I want to create a new matrix that will have all the variables combined with the first column being all the dates recorded and the other columns will be the values of all the variables for these dates. In fewer words, I need to concatenate all matrices by matching up the dates from the first column.
2. Then, I also want to be able to use the dates of one specific variable, let's say the 'V1', as the matching point based on which I can add new columns with the measurements of the rest of the variables.
3. And lastly, I would like to be able to make the matching based on the first 2 columns of the matrices. When I have 3 columns: the first is the date, the second is the depth and the third is the measured value. I want to create a new matrix with the fixed 2 first columns and then the measured values (3rd column elements) of each variable when the depth and the day are the same, when the first 2 elements of each row are the same between the variables.
I have tried a few things but they don't seem to give me the desired result. Any help to any of my sub-questions would be much appreciated.
Kind regards, Niki

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!