%% Plot Data from a Table
% Since R2021b
% A convenient way to plot data from a table is to pass the table to the scatter3 function and specify the variables you want to plot. For example, read patients.xls as a table tbl. Plot the relationship between the Systolic, Diastolic, and Weight variables by passing tbl as the first argument to the scatter3 function followed by the variable names. By default, the axis labels match the variable names.

tbl = readtable('patients.xls');
scatter3(tbl,'Systolic','Diastolic','Weight');

%
% You can also plot multiple variables at the same time. For example, plot both blood pressure variables on the x-axis by specifying the xvar argument as the cell array {'Systolic','Diastolic'}. Then add a legend. The legend labels match the variable names.

scatter3(tbl,{'Systolic','Diastolic'},'Age','Weight');
legend

% Copyright 2020 The MathWorks, Inc.