MATLAB: Making a table with different column widths and autofit contents

errorMATLABmlreportgentable

I am trying to make a table with three different column widths and I just can't seem to get it right.
When I use ColWidth in any of the following formats:
Alltb(1,1)=ColWidth('1in');
Alltb.ColWidth='1in';
Alltb.entry(1,1).Style = {ColWidth('1in')};
Alltb.Children.entry(1,1).Style = {ColWidth('1in')};
Alltb.Children.Entries(1,1).Style = {ColWidth('1in')};
I get an error that that doesn't exist, some variation of:
Unrecognized property 'ColWidth' for class 'mlreportgen.dom.TableEntry'.
I don't understand what mistake I'm making. Alltb is defined as a "Table()". I have tried defining a table entry and then applying colwidth to that with the same problem. I am using Matlab2017b.

Best Answer

I found the answer. It's stupid and unintuitive. Here is the code that worked:
grps(1)=TableColSpecGroup;
grps(1).Span=1;
grps(1).Style={Width('1in')};
grps(2)=TableColSpecGroup;
grps(2).Span=2;
grps(2).Style={Width('2.75')};
Alltb.ColSpecGroups = grps;
Where Span sets the number of columns that the spec applies to.