%% Specify Calculation Method for Color Data
% Create a heatmap and specify the table variable and calculation method to use when determining the heatmap cell colors.
% Load the patients data set and create a heatmap from the data. Color each cell using the median age of patients with a particular pair of Smoker and SelfAssessedHealthStatus values. Specify the ColorVariable option as 'Age' and the ColorMethod option as 'median'.

load patients
tbl = table(LastName,Age,Gender,SelfAssessedHealthStatus,...
    Smoker,Weight,Location);
h = heatmap(tbl,'Smoker','SelfAssessedHealthStatus',...
    'ColorVariable','Age','ColorMethod','median');

% Copyright 2012 The MathWorks, Inc.