NumberFormat on specific/few columns - Report Generator
4 次查看(过去 30 天)
显示 更早的评论
I am formating a table using this line:
tableData = FormalTable(tableData);
tableData.Border = 'Solid';
tableData.RowSep = 'Solid';
tableData.ColSep = 'Solid';
tableData.Style = [tableData.Style {NumberFormat("%.4f")}];
Is it possible to run the NumberFormat on specific/few columns and not on all the table?
0 个评论
回答(1 个)
Rahul Singhal
2022-1-26
Hi Ali,
You can apply NumberFormat to any specific entry, row, or column in a table. Below are some examples:
%% Apply NumberFormat to a specific entry in the table
entry22 = tableData.entry(2,2);
entry22.Style = [entry22.Style {NumberFormat("%.4f")}];
%% Apply NumberFormat to specific row in the table
row3 = tableData.row(3);
row3.Style = [row3.Style {NumberFormat("%.4f")}];
%% Apply NumberFormat to specific column in the table
colNumber = 1;
for iRow = 1:tableData.NRows
tableEntry = tableData.entry(iRow,colNumber);
tableEntry.Style = [tableEntry.Style {NumberFormat("%.4f")}];
end
Thanks,
Rahul
4 个评论
Rahul Singhal
2022-1-27
Suggest to please see the NumberFormat documentation for the valid values: https://www.mathworks.com/help/rptgen/ug/mlreportgen.dom.numberformat-class.html#mw_4aba40ed-1a3f-4df0-a59b-cff0763d442f
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!