%% Access MDF Files
% This example shows you how to open MDF files and access information
% about the file and its contents.

%% Open an MDF File
% Open an MDF file by specifying the name of the target file. Many
% basic details about the file are provided. This sample file was created
% using Vector CANape.
m = mdf("CANapeBasic.MF4")

%% View File Creation Details
% Information about the originating tool of the MDF file is found in the
% |Creator| property.
m.Creator

%% View Channel Group Details
% Data in an MDF file is stored in channels contained within channel
% groups. This sample file contains two channel groups.
m.ChannelGroup(1)
m.ChannelGroup(2)

%% View Channel Details
% Within a channel group, details about each channel are stored.
m.ChannelGroup(1).Channel(1)

%% Quickly Access Channels Names
% The |ChannelNames| property allows quick access to find specific channels
% within the various channel groups.
m.ChannelNames
m.ChannelNames{1}

%% Find Channels in an MDF File
% The |channelList| function is available to quickly and easily query for
% channel details within an MDF file. It returns a case-insensitive, partial 
% match to the provided input by default, but an exact match can also be used.
channelList(m, "PWM")
channelList(m, "PWM", "ExactMatch", true)

%% 
% Copyright 2012-2020 The MathWorks, Inc.