How to Join Tables in report generator?
6 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
If the code goes like this:
import mlreportgen.dom.*
tablecontent1 = { ... };
table1 = Table(tablecontent1);
...
tablecontent2 = { ... };
table2 = Table(tablecontent2);
...
Assuming 2 tables have same colomn number and definitively can adjust some other properties.
How can join them into one single table?
Thanks!
0 Commenti
Risposta accettata
Rahul Singhal
il 13 Ott 2020
Hi John,
You can combine the cell array content and then create the DOM Table:
import mlreportgen.dom.*
tablecontent1 = { ... };
...
tablecontent2 = { ... };
...
% Combine the table content cell arrays and then create DOM Table
tableContent = [tablecontent1; tablecontent2];
table = Table(tableContent);
...
Thanks,
Rahul
2 Commenti
Rahul Singhal
il 14 Ott 2020
Hi John,
In this case, you can merge the DOM tables as shown below:
import mlreportgen.dom.*
tablecontent1 = { ... };
table1 = Table(tablecontent1);
...
tablecontent2 = { ... };
table2 = Table(tablecontent2);
...
% First create a copy of the first table.
% This will make sure that the new "mergedTable" has all the content of table1.
mergedTable = clone(table1);
% Now add second table content to the "mergedTable".
% This is done by adding a copy of each row of second table to the "mergedTable".
for i=1:length(table2.Children)
row = table2.Children(i);
append(mergedTable,clone(row));
end
Thanks,
Rahul
Più risposte (0)
Vedere anche
Categorie
Scopri di più su MATLAB Report Generator in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!