blfread
Read data from Vector BLF file
Description
reads all the data from the specified BLF file and returns a cell array of timetables to the
variable mdata
= blfread(blfFile
)bdata
. The index of each element in the cell array corresponds
to the channel number of the data in the file.
reads message data for the specified channel from the BLF file and returns a
timetable.bdata
= blfread(blfFile
,chanID
)
reads message data filtered by parameter options for CAN database and message IDs.bdata
= blfread(___,Name,Value
)
Examples
Read channel 2 message data from a BLF file using a CAN database.
blfData = blfread("Logging_BLF.blf", 2, "Database", canDB)
blfData = 7575×8 timetable
Time ID Extended Name Data Length Signals Error Remote
__________ ____ ________ __________________ ______________________________ ______ ____________ _____ ______
2.2601 sec 103 false {'Ignition_Info' } {[ 1 0]} 2 {1x1 struct} false false
2.2801 sec 103 false {'Ignition_Info' } {[ 1 0]} 2 {1x1 struct} false false
2.3002 sec 100 false {'EngineData' } {[ 238 2 25 1 0 0 238 2]} 8 {1x1 struct} false false
2.3005 sec 102 false {'EngineDataIEEE'} {[ 0 128 59 68 0 0 0 0]} 8 {1x1 struct} false false
2.3006 sec 103 false {'Ignition_Info' } {[ 1 0]} 2 {1x1 struct} false false
2.3008 sec 201 false {'ABSdata' } {[ 0 0 0 0 172 38]} 6 {1x1 struct} false false
2.3009 sec 1020 false {'GearBoxInfo' } {[ 1]} 1 {1x1 struct} false false
2.3201 sec 103 false {'Ignition_Info' } {[ 1 0]} 2 {1x1 struct} false false
2.3401 sec 103 false {'Ignition_Info' } {[ 1 0]} 2 {1x1 struct} false false
2.3502 sec 100 false {'EngineData' } {[ 4 0 25 2 119 1 238 2]} 8 {1x1 struct} false false
2.3505 sec 102 false {'EngineDataIEEE'} {[53 127 119 64 0 128 187 67]} 8 {1x1 struct} false false
2.3507 sec 201 false {'ABSdata' } {[ 0 0 0 0 35 40]} 6 {1x1 struct} false false
2.3508 sec 1020 false {'GearBoxInfo' } {[ 1]} 1 {1x1 struct} false false
2.3601 sec 103 false {'Ignition_Info' } {[ 1 0]} 2 {1x1 struct} false false
2.3801 sec 103 false {'Ignition_Info' } {[ 1 0]} 2 {1x1 struct} false false
2.4002 sec 100 false {'EngineData' } {[ 10 0 25 3 119 1 238 2]} 8 {1x1 struct} false false
⋮
Other forms of the syntax, applying optional filters, look like the following.
data = blfread("myfile.blf",2) candb = canDatabase("testdb.dbc"); data = blfread("myfile.blf", "Database", candb) data = blfread("myfile.blf", "Database", candb, "CANStandardFilter", 1:10) data = blfread("myfile.blf", "Database", candb, "CANExtendedFilter", 3:7) data = blfread("myfile.blf", "Database", candb, "CANStandardFilter", 1:10, ... "CANExtendedFilter", 3:7) data = blfread("myfile.blf", "CANStandardFilter", 1:10, "CANExtendedFilter", 3:7)
Input Arguments
Path to BLF file, specified as a string or character vector. The value can specify a file in the current folder, or a relative or full path name.
Example: "MultipleChannelFile.blf"
Data Types: string
| char
Channel ID, specified as a numeric scalar value, for which to read data from the BLF file. If not specified, all channels are read.
Example: 2
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
Name-Value Arguments
Specify optional pairs of arguments as
Name1=Value1,...,NameN=ValueN
, where Name
is
the argument name and Value
is the corresponding value.
Name-value arguments must appear after other arguments, but the order of the
pairs does not matter.
Before R2021a, use commas to separate each name and value, and enclose
Name
in quotes.
Example: "CANStandardFilter",1:8
Database to use for message decoding, specified as a CAN, ARXML, or LIN
Database
object. You can create this object with the canDatabase
, arxmlDatabase
, or linDatabase
function.
Message standard IDs, specified as an array of numeric values identifying which messages to import. Message IDs are general, and apply to both CAN and CAN FD bus types. The value can specify a scalar or an array of either a range or noncontiguous IDs. By default, all standard ID messages are imported.
Example: [1:10 45 100:123]
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
Message extended IDs, specified as an array of numeric values identifying which messages to import. Message IDs are general, and apply to both CAN and CAN FD bus types. The value can specify a scalar or an array of either a range or noncontiguous IDs. By default, all extended ID messages are imported.
Example: [1 8:10 1001:1080]
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
Return absolute timestamps, specified as true
or
false
. If specified true
, the returned
timetable has absolute timestamps in datetime. If specified false
,
the returned timetable has relative timestamps in duration, elapsed from the initial
timestamp of the file. The default value is false
, to return
relative timestamps.
Example: AbsoluteTime=true
Data Types: logical
Start time and end time of an interval to read data from, specified as a 2-element
vector. If AbsoluteTime=true
, specify TimeRange
as a datetime vector. If AbsoluteTime=false
(default), specify
TimeRange
as a duration vector. If unspecified, all data samples
are read. You cannot combine this option with IndexRange
.
Example: TimeRange=seconds([0,60])
Data Types: datetime
| duration
Start index and end index of the interval to read data from, specified as a
2-element vector. The indices are inclusive. If unspecified, all data samples are
read. You cannot combine this option with TimeRange
.
Example: IndexRange=[65:128]
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
Message format, specified as "CAN"
or "LIN"
.
The default is "CAN"
. If you specify a Database argument for
message decoding, it must be consistent with this protocol.
Example: ProtocolMode="LIN"
Data Types: char
| string
Output Arguments
Message data from BLF file, returned as a cell array of timetables. If you specify a single channel to read, this returns a timetable.
Version History
Introduced in R2019aDatabase
argument now allows specifying an ARXML or LIN
Database
object.
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Seleziona un sito web
Seleziona un sito web per visualizzare contenuto tradotto dove disponibile e vedere eventi e offerte locali. In base alla tua area geografica, ti consigliamo di selezionare: .
Puoi anche selezionare un sito web dal seguente elenco:
Come ottenere le migliori prestazioni del sito
Per ottenere le migliori prestazioni del sito, seleziona il sito cinese (in cinese o in inglese). I siti MathWorks per gli altri paesi non sono ottimizzati per essere visitati dalla tua area geografica.
Americhe
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)