%% Specify Table Variable for Heatmap Colors
% Create a heatmap and specify the table variable 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 average age of patients with a particular pair of Smoker and SelfAssessedHealthStatus values by setting the ColorVariable option to 'Age'.

load patients
tbl = table(LastName,Age,Gender,SelfAssessedHealthStatus,...
    Smoker,Weight,Location);

h = heatmap(tbl,'Smoker','SelfAssessedHealthStatus',...
    'ColorVariable','Age');

% Copyright 2012 The MathWorks, Inc.