Merge columns in two tables depending on column names
11 visualizzazioni (ultimi 30 giorni)
I have two tables consisting of six and 21 columns. I want to create three new tables based on the column names in the aforementioned tables. This I want to perform depending on the 10th and 12th position in the first table with six columns (see Mat_question-file). The 10th and 12th position contains values of 1/2, 3/4 or 5/6. These values (i.e. 1/2, 3/4 or 5/6) in the first table, I want to merge with the columns in table no.2 based on position 7. Position 7 in the second table (21 columns) contains the values of 2,3 or 6 ( see Mat_question2-file). I want to merge all the columns in the second table with the same value, i.e. 2,3 and 6, on the 7th position. Thereafter, I want to to merge the already merged columns from the second table with the first table based on if the 10th or 12th value in each column (table 1) contains a 1 or 2, a 3 or 4, or a 5 or 6. Hence, as an example, the columns in table 2 that contain a 3 on the 7th position should be connected with the columns in table 1 that contain a 3 on the 10th or 12th position. Based on this I should get three new tables with the conditions described above.
Quite a messy problem. Happy to elaborate.
The files are attached in the question.
Thanks in advance MatLab-friends
Jon il 8 Dic 2021
I think you can probably accomplish what you want using one or more of MATLAB's join, innerjoin, and outerjoin commands.
Please look at the documentation for those, try to code up as far as you can get and if you are still stuck post for more help.