read
Read next VITA 49 packet from file
Syntax
Description
[
reads the next packet from the VMEbus International Trade Association (VITA) 49 file
specified by the input VITA 49 file reader object, signalDataPacket
,contextPacket
,contextPacketChangeIndex
] = read(vita49ReaderObj
)vita49ReaderObj
, and
returns the signal data packet, signalDataPacket
, and context packet,
contextPacket
. The function also returns the starting indices of the
signal data packets after any new context packet arrival, in
contextPacketChangeIndex
.
[___] = read(
specifies one or more optional name-value arguments, in addition to the output arguments
from the previous syntax. For example, vita49ReaderObj
,Name=Value
)StreamID=2
sets the stream
identifier to 2.
Examples
Read Specified Number of Packets from File
Create a VITA 49 file reader object, specifying the name of a VITA 49 file and an output format for the packet timestamp.
vita49ReaderObj = vita49Reader("VITA49SampleData.bin"); vita49ReaderObj.OutputTimestampFormat = "seconds";
Specify the number of packets to be read from the file.
numpkt = 11;
Read the specified number of packets from the VITA 49 file to the MATLAB® workspace.
[signalDataPacket,contextPacket,contextPacketChangeIndex] = read(vita49ReaderObj,NumPackets=numpkt)
signalDataPacket = struct with fields:
PacketType: 1
StreamID: 0
ClassID: "7C386C0000"
PadBitCount: 0
IntegerTimestampType: "GPS"
IntegerTimestampValue: 1625215654
FractionalTimestampType: "real time"
FractionalTimestampValue: 900000344000
RawBytes: [1472x1 uint8]
IQSamples: [361x1 double]
Trailer: [1x1 struct]
contextPacket=1×10 struct array with fields:
PacketType
StreamID
ClassID
IntegerTimestampType
IntegerTimestampValue
FractionalTimestampType
FractionalTimestampValue
RawBytes
ContextFieldChangeIndicator
ReferencePointIdentifier
Bandwidth
IFReferenceFrequency
RFFrequency
RFFrequencyOffset
IFBandOffset
ReferenceLevel
Gain
OverRangeCount
SampleRate
TimestampAdjustment
TimestampCalibrationTime
StateAndEventIndicator
SignalDataPayloadFormat
⋮
contextPacketChangeIndex = 1×10
0 0 0 0 0 0 0 0 0 1
Read Packets in Streaming Mode from File
Create a VITA 49 file reader object, specifying the name of a VITA 49 file.
vita49ReaderObj = vita49Reader("VITA49SampleData.bin");
Set the stream identifier as 1, class identifier as "736C860000", and packet type as signal data packet.
pktType = "signal data"; streamID = 0; classID = "7C386C0000";
In streaming mode, read the VITA 49 packets that match the specified filters to the MATLAB workspace.
for idx = 1:3 signalDataPacket = read(vita49ReaderObj, ... PacketType=pktType,StreamID=streamID,ClassID=classID) end
signalDataPacket = struct with fields:
PacketType: 1
StreamID: 0
ClassID: "7C386C0000"
PadBitCount: 0
IntegerTimestampType: "GPS"
IntegerTimestampValue: 1625215654
FractionalTimestampType: "real time"
FractionalTimestampValue: 900000344000
RawBytes: [1472x1 uint8]
IQSamples: [361x1 double]
Trailer: [1x1 struct]
signalDataPacket = struct with fields:
PacketType: 1
StreamID: 0
ClassID: "7C386C0000"
PadBitCount: 0
IntegerTimestampType: "GPS"
IntegerTimestampValue: 1625215654
FractionalTimestampType: "real time"
FractionalTimestampValue: 900042328000
RawBytes: [1472x1 uint8]
IQSamples: [361x1 double]
Trailer: [1x1 struct]
signalDataPacket = struct with fields:
PacketType: 1
StreamID: 0
ClassID: "7C386C0000"
PadBitCount: 0
IntegerTimestampType: "GPS"
IntegerTimestampValue: 1625215654
FractionalTimestampType: "real time"
FractionalTimestampValue: 900084248000
RawBytes: [1472x1 uint8]
IQSamples: [361x1 double]
Trailer: [1x1 struct]
Input Arguments
vita49ReaderObj
— VITA 49 file reader
vita49Reader
object
VITA 49 file reader, specified as a vita49Reader
object.
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: StreamID=2
sets the stream identifier to 2.
PacketType
— Type of packet to be read
"signal data"
| "context"
Type of packet to be read, specified as "signal data"
or
"context"
. If you do not specify this argument, the function
reads the next packet from the file.
Data Types: char
| string
NumPackets
— Number of packets to be read
1
(default) | positive integer
Number of packets to be read, specified as a positive integer.
Data Types: double
StreamID
— Stream identifier
nonnegative integer
Stream identifier, specified as a nonnegative integer.
If you specify StreamID
, the function identifies the packets
belonging to only the specified ID from the packet stream.
Data Types: uint32
ClassID
— Class identifier
character vector | string scalar
Class identifier, specified as a character vector or string scalar.
A class identifier is a 5-byte-long, hex-formatted string that includes three bytes of Organizational Unique Identifier (OUI) information and two bytes of information class code.
Data Types: char
| string
Output Arguments
signalDataPacket
— Decoded signal data packet
structure
Decoded signal data packet, returned as a structure containing these fields.
Field | Description | Value | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
PacketType | Type of VITA 49 packet, returned as one of these values.
| Integer in the range [0, 5] | ||||||||||||||||||||||
StreamID | Stream ID, as specified by the name-value argument | 32-bit unsigned integer | ||||||||||||||||||||||
ClassID | Class ID, as specified by the name-value argument | Character vector or string scalar | ||||||||||||||||||||||
PadBitCount | Pad bit count is the difference between the nearest multiple of 32 and the actual number of payload bits to pack, returned as a nonnegative integer. Pad bits are required when the size and number of data items do not completely fill the last 32-bit word of a data packet. | 8-bit unsigned integer | ||||||||||||||||||||||
IntegerTimestampType | Integer timestamp type, returned as | Character vector or string scalar | ||||||||||||||||||||||
IntegerTimestampValue | Integer timestamp value, in seconds. This value represents the Reference Point Time of data samples or metadata in the packet, returned to 1-second resolution accuracy. | 32-bit unsigned integer | ||||||||||||||||||||||
FractionalTimestampType | Fractional timestamp, returned as When this value is | Character vector or string scalar | ||||||||||||||||||||||
FractionalTimestampValue | Fractional timestamp value in picoseconds, represents the Reference Point Time of data samples or metadata in the packet, returned as a timestamp of higher resolution than the integer timestamp value. | 64-bit unsigned integer | ||||||||||||||||||||||
RawBytes | Raw payload in bytes, which is not decoded, returned as a column vector. | Column vector with 8-bit unsigned integer elements | ||||||||||||||||||||||
IQSamples | Decoded real or complex in-phase quadrature (IQ) Cartesian samples of the signal data, returned as a column vector. This function does not support decoding of complex Polar samples. | Column vector with elements of data type
double | ||||||||||||||||||||||
Trailer | Validity of the decoded data and the status of the processes producing that data, returned as a structure with these fields.
| Structure |
Data Types: struct
contextPacket
— Decoded context packet
structure
Decoded context packet, returned as a structure containing these fields.
Field | Description | Value | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
PacketType | Type of VITA 49 packet, returned as one of these values.
| Integer in the range [0, 5] | ||||||||||||||||||||||||
StreamID | Stream ID, as specified by the name-value argument | 32-bit unsigned integer | ||||||||||||||||||||||||
ClassID | Class ID, as specified by the name-value argument | Character vector or string scalar | ||||||||||||||||||||||||
IntegerTimestampType | Integer timestamp type, returned as | Character vector or string scalar | ||||||||||||||||||||||||
IntegerTimestampValue | Integer timestamp value, in seconds. This value represents the Reference Point Time of data samples or metadata in the packet, returned to 1-second resolution accuracy. | 32-bit unsigned integer | ||||||||||||||||||||||||
FractionalTimestampType | Fractional timestamp, returned as When this value is | Character vector or string scalar | ||||||||||||||||||||||||
FractionalTimestampValue | Fractional timestamp value in picoseconds, represents the Reference Point Time of data samples or metadata in the packet, returned as a timestamp of higher resolution than the integer timestamp value. | 64-bit unsigned integer | ||||||||||||||||||||||||
RawBytes | Raw payload in bytes, which is not decoded, returned as a column vector. | Column vector with 8-bit unsigned integer elements | ||||||||||||||||||||||||
ContextFieldChangeIndicator | Bit indicator returned as | 0 (false ) or 1
(true ) | ||||||||||||||||||||||||
ReferencePointIdentifier | Reference point ID consists of the | 32-bit unsigned integer | ||||||||||||||||||||||||
Bandwidth | Usable spectrum at the output of a communication channel, returned as a nonnegative scalar in hertz. | Nonnegative scalar | ||||||||||||||||||||||||
IFReferenceFrequency | Intermediate frequency (IF) at which a carrier wave shifts as an intermediate step in transmission or reception of the signal, returned as a real scalar in hertz. | Real scalar | ||||||||||||||||||||||||
RFFrequency | Location in the signal path that corresponds to the original frequency, returned as a real scalar in hertz. | Real scalar | ||||||||||||||||||||||||
RFFrequencyOffset | Intentional slight deviation of the broadcast radio frequency (RF) to reduce the interference with other transmitters, returned as a real scalar in hertz. | Real scalar | ||||||||||||||||||||||||
IFBandOffset | IF offset from the | Real scalar | ||||||||||||||||||||||||
ReferenceLevel | Physical signal amplitude at a reference point relative to the corresponding data sample value, returned as a real scalar in dB. | Real scalar | ||||||||||||||||||||||||
Gain | Amount of signal gain or signal attenuation from the reference point, returned as a real scalar in dB. | Real scalar | ||||||||||||||||||||||||
OverRangeCount | Number of data samples in the paired data packet whose amplitudes are beyond the range of the data item format, returned as a nonnegative integer in dB. | 32-bit unsigned integer | ||||||||||||||||||||||||
SampleRate | Sampling rate of the data samples in the payload of a paired data packet stream, returned as a positive integer in hertz. | Positive integer | ||||||||||||||||||||||||
TimeStampAdjustment | Delay used to adjust the timestamp information of the first packet of the file, returned as a structure with these fields.
| Structure | ||||||||||||||||||||||||
TimestampCalibrationTime | Conveys the date and time at which the timestamp in the data signal packet and context packet was confirmed accurate, returned as a nonnegative integer. | 32-bit unsigned integer | ||||||||||||||||||||||||
StateAndEventIndicator | Conveys a set of binary indications and a limited number of non-binary state indications, returned as a structure with these fields. This structure field is equivalent to be the
| Structure | ||||||||||||||||||||||||
SignalDataPayloadFormat | Consists of the format of the real or complex signal data (of either 8, 16, or 32 bits) and the data item size, returned as a structure with these fields.
| Structure |
Data Types: struct
contextPacketChangeIndex
— Starting indices of signal data packets after any new context packet arrival
array of nonnegative integers
Starting indices of the signal data packets after any new context packet arrival, returned as an array of nonnegative integers.
When two context packets arrive one after another, the corresponding value returned is two zeros.
Data Types: double
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Usage notes and limitations:
Code generation is available only when the OutputTimestampFormat
property of the vita49Reader
object is set to the default value of
"seconds"
.
Version History
Introduced in R2022b
Ouvrir l'exemple
Vous possédez une version modifiée de cet exemple. Souhaitez-vous ouvrir cet exemple avec vos modifications ?
Commande MATLAB
Vous avez cliqué sur un lien qui correspond à cette commande MATLAB :
Pour exécuter la commande, saisissez-la dans la fenêtre de commande de MATLAB. Les navigateurs web ne supportent pas les commandes MATLAB.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- 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)