% replayCANData Replay pre-recorded data for the CAN Explorer reception and
% visualization example.
%
% Copyright 2020 The MathWorks, Inc.

% Load the timetable of CAN messages used for replay.
load("CANExplorerData.mat", "canMsgs")

% Create a CAN channel connection using MathWorks Virtual 1 Channel 2.
ch = canChannel("MathWorks", "Virtual 1", 2);

% Configure the channel bus speed.
configBusSpeed(ch, 500000)

% Start the channel connection.
start(ch)

% Replay the CAN messages.
replay(ch, canMsgs)

% Since the timetable contains about 60 seconds of data, pause for the same
% length of time for replay to complete.
pause(60)
