Create style for table UI component
s = uistyle
creates an empty style for a table UI component and
returns the Style
object. Use Style
objects to
create color, font, and alignment styles for cells in table UI components. Use this syntax
to create a style you want to add properties to later.
s = uistyle(
specifies
Name,Value
)Style
property values using one or more name-value pair arguments. For
example, 'BackgroundColor','g'
sets the background color to green.
Style
objects that you add to the
table UI component take visual precedence over properties you set on the
Table
object, no matter the order in which you created them. For
example, in this code the blue font color displays in the table even though red foreground
color was set on the Table
object last.
uit = uitable(uifigure,'Data',rand(100,10)); s = uistyle; s.FontColor = 'blue'; addStyle(uit,s); uit.ForegroundColor = 'red';