MATLAB Answers

How to set the variable formats in a Report Generator table?

1 view (last 30 days)
Inso
Inso on 16 Dec 2019
Answered: Sean de Wolski on 16 Dec 2019
Hi, I'm using the Report Generator and I need to output some tables, which contain the computation results.
However, the table in the report displaces very long digits, like '1.234345', which make the table a mess. I tried the solution in other threads:
table1 = varfun(@(var) round(var, 3), table1);
But it left all the zeros: '1.234000'.
Is there anyway to get rid of the zeros, or just simply change the formats of the table variables(columns)?

  0 Comments

Sign in to comment.

Accepted Answer

Sean de Wolski
Sean de Wolski on 16 Dec 2019
In R2019b, the https://www.mathworks.com/help/releases/R2019b/rptgen/ug/mlreportgen.report.matlabvariable-class.html has a NumericFormat property. Before this, you need to convert the numbers to strings yourself using compose() or sprintf()

  0 Comments

Sign in to comment.

More Answers (0)

Sign in to answer this question.

Products


Release

R2019a