Comparing and exporting data from 3 tables

5 visualizaciones (últimos 30 días)
Sigurd Otterå
Sigurd Otterå el 10 de Jul. de 2019
Respondida: Dheeraj Singh el 29 de Jul. de 2019
Create a script that first takes in a large table (main table, very large), table1, and a smaller table, table2. The script should then find common elements in the main table and in the second table table 2 for a given column number and count the number as a result. Then the function should export them as a new table where the common elements are colored (eg green).
Then, the script must take a table and count common elements in a third table, table3, for a given column, and count them as a result. Then the function should export them as a new table where the common elements are colored (eg red). It should also count the number of common elements as a result.
  Then we take and find common elements from table2 and table3 and color the orange in the main table, also count the number of common elements. , Then it must export a total table based on the main table, where the common elements from table 2 are colored green in the main table and the common elements from table 3 are colored red and those common to both table 2 and table 3 are colored orange.

Respuestas (1)

Dheeraj Singh
Dheeraj Singh el 29 de Jul. de 2019
I understand that you want to compare columns of different tables and then export them as a new table and highlight the common element with different colors (red, green, orange).
For comparing the elements of the column, you can use the following strategy:
Since the number of elements in the columns is different for all tables you can use intersect and numel to count number of common elements.
commonElements=intersect(table1(: ,columnName),table2(:,columnName));
You can then use the App Designer to export the table and highlight common elements.
For plotting the table to highlight the common elements you can refer to this MATLAB Answer to set the color of each cell of the table:

Categorías

Más información sobre Cell Arrays en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by