%% Remove Subset of Styles from Table
% Add multiple styles to a table UI component, and then remove some of them.
% First, create a table UI component and add styles to different parts of it.

fig = uifigure; 
fig.Position = [500 500 720 230]; 
uit = uitable(fig); 
uit.Data = randi([-20,20],7); 
uit.Position = [20 30 680 185]; 
 
[row,col] = find(uit.Data<0);

s1 = uistyle;
s1.BackgroundColor = 'cyan';
addStyle(uit,s1,'column',[1 3 5]) 

s2 = uistyle;
s2.FontColor = 'red';
s2.FontWeight = 'bold';
addStyle(uit,s2,'cell',[row,col])

s3 = uistyle('BackgroundColor','green');
addStyle(uit,s3,'row',[3 4])

addStyle(uit,s1,'column',7)

%
%
% Now, remove the row and column styles. First, query the value of the StyleConfigurations property for the table.

uit.StyleConfigurations

%
% The StyleConfigurations property value shows that style order numbers 1 and 4 affect columns, and that the row style was the third style added to the table. Remove the styles by specifying style order numbers 1, 3, and 4.

removeStyle(uit,[1 3 4])

%
% Copyright 2019 The MathWorks, Inc.