MATLAB: How to adjust the columns to the size of the text in each cell with MATLAB Report Generator 3.2 (R2007a)

MATLAB Report Generator

1. In MATLAB type:
a = randn(20)
2. Download attached file test.rpt
3. Open Report Generator
4. Select test.rpt as template report
5. Run report
You will get a PDF file with 20 rows and 20 columns
The issue is that the columns are adjusted to the size of the page and not adjusted to the size of the text in each cell (find enclosed test.pdf)
Is there another more elegant solution?

Best Answer

  • This ability to adjust columns to the size of the text in each cell is not availabe in the MATLAB Report Generator.
    A possible workaround is to create 2 "table" components. In the first "table" component, in the "workspace variable name" field, enter "a(:,1:10)". In the second "table" component, in the "workspace variable name" field, enter "a(:,11:20)".
    (find enclosed test2.pdf)
    This limitation is due to the fact that tables and fonts are separate entities. Report Generator does provide a way for setting fonts inside a table or calculating what the proper font size should be.