Conditional formatting for MATLAB Report Generator Table
14 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I'm generating a report using MATLAB Report Generator and I've created a FormalTable() object and populated it with a m x n cell array of data. I've been trying to conditionally format the cells with no success. I can't seem to find a way to access individual cells of the FormalTable() to set a BackgroundColor property (or any other formatting property). Any style format objects I assign to FormalTable() properties such as TableEntriesStyle or Style set that format globally for the entire table.
The workaround is to rather create a m*n series of Text() objects for which I can individually set format properties based on some condition. The challenge is then aligning those text objects on the page to resemble a table. I cannot seem to find how to set the size and location properties of a text object in order to place it on a page.
Any suggestions on how to create a conditionally formatted table for a MATLAB report?
0 commentaires
Réponses (1)
Krishnan Ramkumar
le 8 Déc 2016
Modifié(e) : Krishnan Ramkumar
le 8 Déc 2016
You can access individual cell from a Formal Table. A sample example code snippet to access and modify Styles of table entry
import mlreportgen.dom.*;
doc = Document('test');
a = magic(5);
table = FormalTable(a);
table.RowSep = 'Solid'
table.ColSep = 'Solid'
table.Border = 'Solid'
table.Body.entry(1,2).Style = {Color('red')} ;
table.Body.entry(1,1).Style = {BackgroundColor('Green')};
append(doc,table);
close(doc);
rptview(doc.OutputPath);
0 commentaires
Voir également
Catégories
En savoir plus sur MATLAB Report Generator dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!