Joining Tables and deleting columns

4 Ansichten (letzte 30 Tage)
Jana Sarran
Jana Sarran am 27 Mär. 2023
Kommentiert: Peter Perkins am 4 Apr. 2023
Hi everyone,
How can I add two tables into a third table and how can I delete columns in a third table.
I have two tables which only contains 1 column of information. However, the information is required to replace data contained under two headings in another table - SecondVID and FirstVID.
How can I take the column data of the two tables and insert it into the third?
  5 Kommentare
Jana Sarran
Jana Sarran am 28 Mär. 2023
Bearbeitet: Jana Sarran am 28 Mär. 2023
Thank you for your response. This question was posted as another step that has to be taken after the data was sorted in the previous question.
I need to use the table format for my dataset to obtain my final results in matlab. Additionally, my dataset is larger over 3000 rows. Hence, I do not think treating the data as identifiers is possible. Maybe you can advise on this.
In summary this is what I want to achieve:
Step 1: I would like to search Table 2 for the values in Table 1
TABLE 1
TABLE 2
Step 2: Once similar values are found, I would like the "Similar" values identified in coloumns "FirstVID" and "SecondVID" to be updated with the words "AV".
I would like this to update Table 2. As opposed to generating a different table for only FirstVID and SecondVID. In other words the table would appear like:
I would also like to replace the other IDs to DVs. Example, 1348 should be "DV"
NOTE; The table has a large number of rows. Also, I would like to use the index function (idx) to sort the data in the TTC column. I can not do this if the data is a string.
Thank you for your assistance.
Peter Perkins
Peter Perkins am 4 Apr. 2023
I'm pretty sure my previous post exactly answered what you've described:
  • Find values from one vector in another vector.
  • Replace the values in the other vector with something else.
  • The something else is text.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Swaraj
Swaraj am 4 Apr. 2023
Step 1: Joining two tables
You can join two tables in MATLAB using the “join()” function.
Eg. Table3 = join(table1,table2);
Documentation for “join()”:
Step 2: Removing a column from the third table.
You can use “removevars” function.
Documentation for “removevars” function.

Kategorien

Mehr zu Tables finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by