Baseband File Reader
Read baseband signals from file
Libraries:
Communications Toolbox /
Comm Sources
Description
The Baseband File Reader block reads a signal from a baseband file. A baseband file is a specific type of binary file written by the Baseband File Writer block. Baseband signals are typically downconverted from a nonzero center frequency to 0 Hz. The block automatically reads the sample rate, center frequency, number of channels, and any descriptive data.
Examples
Write Baseband Signal to File in Simulink
Generate and write a QPSK-modulated signal to a file. Then, read the file and plot the constellation diagram of the signal.
The model cm_baseband_writer_ex1
generates a QPSK-modulated signal and writes the noisy QPSK signal to a file named bbw_example.bb
.
Open a second model, cm_baseband_writer_ex2
, to read the signal from the file and display the constellation diagram.
Read Baseband Signal from File in Simulink
Read the baseband signal from the saved file example.bb.
The baseband_samples_1ghz.bb file contains 10,000 samples having a sample rate of 1 Hz. The simulation stop time for the model is set to 12,000. The Baseband File Reader
block configuration has Inherit sample time from file
enabled, Samples per frame
set to 100, and Repeatedly read the file
disabled. As a result, the simulation time exceeds the amount of saved data and the last 2000 samples are zero padded.
The Baseband File Reader
block configuration is modified to enable the Repeatedly read the file
parameter. Now, when the model runs, after 10,000 s, the file is read again so the samples from 10,000 to 12,000 s are a repeat of the first 2000 samples.
Ports
Output
Data — Baseband signal
scalar | vector | matrix
Baseband signal, returned as a scalar, vector, or matrix. The signal is read from the file specified by the Baseband file name parameter. The sample time is either inherited from the file or can be set by the Sample Time (s) parameter.
Data Types: double
Complex Number Support: Yes
EOF — End-of-file indicator
logical scalar
End-of-file indicator, returned as a logical scalar. The output is
true
when the Repeatedly read the
file parameter is false
and the entire
file has been read. To enable this port, select the Output
end-of-file indicator parameter.
Parameters
To edit block parameters interactively, use the Property Inspector. From the Simulink® Toolstrip, on the Simulation tab, in the Prepare gallery, select Property Inspector.
Baseband file name — Name of baseband file to read
example.bb
(default) | character vector
Name of the baseband file to read, specified as a string scalar or character vector.
Click Browse to locate the baseband file you want to read.
Click File Info to display this information:
File name, including absolute path
Sample rate
Center frequency
Number of samples
Number of channels
Data type
Any metadata fields
If the file has no descriptive data, this property is an empty structure.
If the baseband file writer defined the object with a function call, the bb-file stores that function call. The baseband file reader executes the function call to display the object.
If you are licensed to use the software associated with that feature, the metadata output contains the object contents.
If you are not licensed to use the software associated with that feature, the metadata output contains the string rather than the object contents.
Inherit sample time from file — Select source of sample time
on
(default) | off
Select this check box to inherit the sample time from the file specified by Baseband file name.
Sample time (s) — Block sample time
1
(default) | positive scalar
Specify the block sample time in seconds as a positive scalar. To enable this parameter, clear the Inherit sample time from file check box.
Samples per frame — Number of samples per output frame
100
(default) | positive integer scalar
Number of samples per output frame, specified as a positive integer or
inf
. When this parameter is inf
,
the output frame contains all of the samples in the baseband file.
Repeatedly read the file — Continuously loop data from file
off
(default) | on
Select this check box to repeatedly read the contents of the baseband file. When the end of the file is reached:
The block outputs zeros, if the Repeatedly read the file parameter is not selected (
off
).The block outputs samples from the beginning of the file, if the Repeatedly read the file parameter is selected (
on
).
Simulate using — Type of simulation to run
Code generation
(default) | Interpreted execution
Type of simulation to run, specified as Code generation
or
Interpreted execution
.
Code generation
— Simulate the model by using generated C code. The first time you run a simulation, Simulink generates C code for the block. The model reuses the C code for subsequent simulations unless the model changes. This option requires additional startup time, but the speed of the subsequent simulations is faster than with theInterpreted execution
option.Interpreted execution
— Simulate the model by using the MATLAB® interpreter. This option shortens startup time, but the speed of subsequent simulations is slower than with theCode generation
option. In this mode, you can debug the source code of the block.
For more information, see Interpreted Execution vs. Code Generation (Simulink).
Block Characteristics
Data Types |
|
Multidimensional Signals |
|
Variable-Size Signals |
|
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
Version History
Introduced in R2016bR2024a: Support reading objects from metadata
The Baseband File Reader block now supports reading objects and structures-of-structures from the saved metadata.
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.
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)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)