MATLAB Examples

This is an example of how to create a datetime plot (bar chart) in MATLAB®.

Read about the datetime function in the MATLAB documentation. This function is available in R2016b or newer.

For more examples, go to MATLAB Plot Gallery

% Check version
if verLessThan('matlab','9.1')
    error('heatmap is available in R2016b or newer.')

% Load bike ride summary data
load RideSummary byMonth

% Create a bar chart of number of bike rides per month
bar(byMonth.Month, byMonth.NumRides)

% Add labels and title
ylabel('Number of Rides')
title('Number of Bike Rides for the Year 2012')