Этот пример показывает вам, как открыть MDF-файлы и информацию о доступе о файле и его содержимом.
Откройте MDF-файл с помощью mdf путем определения имени конечного файла. Предоставлены много основной подробной информации о файле. Этот файл примера был создан с помощью Векторного CANape™.
m = mdf("CANapeBasic.MF4")m =
MDF with properties:
File Details
Name: 'CANapeBasic.MF4'
Path: '/tmp/BR2021bd_1751886_255755/mlx_to_docbook1/tp43650a5e/vnt-ex51113426/CANapeBasic.MF4'
Author: 'Otmar Schneider'
Department: 'PMC @ Vector Informatik GmbH'
Project: 'Demo'
Subject: 'XCPSim'
Comment: 'Example file created with Vector CANape'
Version: '4.10'
DataSize: 176545
InitialTimestamp: 2016-04-21 14:27:17.000010630
Creator Details
ProgramIdentifier: 'MCD14.02'
Creator: [1x1 struct]
File Contents
Attachment: [0x1 struct]
ChannelNames: {2x1 cell}
ChannelGroup: [1x2 struct]
Options
Conversion: Numeric
Информация об инициирующем инструменте MDF-файла найдена в Creator свойство.
m.Creator
ans = struct with fields:
VendorName: 'Vector Informatik GmbH'
ToolName: 'CANape'
ToolVersion: '14.0.20.2386'
UserName: 'visosr'
Comment: 'created'
Данные в MDF-файле хранятся в каналах, содержавших в группах канала. Этот файл примера содержит две группы канала.
m.ChannelGroup(1)
ans = struct with fields:
AcquisitionName: '10 ms'
Comment: '10 ms'
NumSamples: 1993
DataSize: 153461
Sorted: 1
Channel: [74x1 struct]
m.ChannelGroup(2)
ans = struct with fields:
AcquisitionName: '100ms'
Comment: '100ms'
NumSamples: 199
DataSize: 23084
Sorted: 1
Channel: [46x1 struct]
В группе канала хранятся детали о каждом канале.
m.ChannelGroup(1).Channel(1)
ans = struct with fields:
Name: 'Counter_B4'
DisplayName: ''
ExtendedNamePrefix: 'XCPsim'
Description: 'Single bit demo signal (bit from a byte shifting)'
Comment: 'Single bit demo signal (bit from a byte shifting)'
Unit: ''
Type: FixedLength
DataType: IntegerUnsignedLittleEndian
NumBits: 1
ComponentType: None
CompositionType: None
ConversionType: ValueToText
ChannelNames свойство предоставляет быстрый доступ, чтобы найти определенные каналы в различных группах канала.
m.ChannelNames
ans=2×1 cell array
{74x1 cell}
{46x1 cell}
m.ChannelNames{1}ans = 74x1 cell
{'Counter_B4' }
{'Counter_B5' }
{'Counter_B6' }
{'Counter_B7' }
{'PWM' }
{'PWM_Level' }
{'PWMFiltered' }
{'Triangle' }
{'map1_8_8_uc_measure[0][0]'}
{'map1_8_8_uc_measure[0][1]'}
{'map1_8_8_uc_measure[0][2]'}
{'map1_8_8_uc_measure[0][3]'}
{'map1_8_8_uc_measure[0][4]'}
{'map1_8_8_uc_measure[0][5]'}
{'map1_8_8_uc_measure[0][6]'}
{'map1_8_8_uc_measure[0][7]'}
{'map1_8_8_uc_measure[1][0]'}
{'map1_8_8_uc_measure[1][1]'}
{'map1_8_8_uc_measure[1][2]'}
{'map1_8_8_uc_measure[1][3]'}
{'map1_8_8_uc_measure[1][4]'}
{'map1_8_8_uc_measure[1][5]'}
{'map1_8_8_uc_measure[1][6]'}
{'map1_8_8_uc_measure[1][7]'}
{'map1_8_8_uc_measure[2][0]'}
{'map1_8_8_uc_measure[2][1]'}
{'map1_8_8_uc_measure[2][2]'}
{'map1_8_8_uc_measure[2][3]'}
{'map1_8_8_uc_measure[2][4]'}
{'map1_8_8_uc_measure[2][5]'}
⋮
channelList функция доступна для быстро, и легко запросите для деталей канала в MDF-файле. Это возвращает нечувствительное к регистру, частичное соответствие в обеспеченный вход по умолчанию, но точное совпадение может также использоваться.
channelList(m, "PWM")ans=3×9 table
ChannelName ChannelGroupNumber ChannelGroupNumSamples ChannelGroupAcquisitionName ChannelGroupComment ChannelDisplayName ChannelUnit ChannelComment ChannelDescription
_____________ __________________ ______________________ ___________________________ ___________________ __________________ ___________ ______________________________________________ ________________________________________________
"PWM" 1 1993 10 ms 10 ms "" <undefined> Pulse width signal from PWM_level and Triangle "Pulse width signal from PWM_level and Triangle"
"PWM_Level" 1 1993 10 ms 10 ms "" <undefined> <undefined> ""
"PWMFiltered" 1 1993 10 ms 10 ms "" <undefined> Low pass filtered PWM signal "Low pass filtered PWM signal"
channelList(m, "PWM", "ExactMatch", true)
ans=1×9 table
ChannelName ChannelGroupNumber ChannelGroupNumSamples ChannelGroupAcquisitionName ChannelGroupComment ChannelDisplayName ChannelUnit ChannelComment ChannelDescription
___________ __________________ ______________________ ___________________________ ___________________ __________________ ___________ ______________________________________________ ________________________________________________
"PWM" 1 1993 10 ms 10 ms "" <undefined> Pulse width signal from PWM_level and Triangle "Pulse width signal from PWM_level and Triangle"
Закройте доступ к MDF-файлу путем очищения его переменной из рабочей области.
clear m