hasNextMessage
Description
checks if the IDC file selection has a subsequent message to read. This object function
returns flag
= hasNextMessage(msgReader
)true
if there is a next message available to read from the
ibeoMessageReader
object, msgReader
. Otherwise, it returns
false
.
Examples
Read and Visualize Sensor Messages from IDC File
Create an ibeoFileReader
object, ibeoReader
,
to read the message headers from the IDC file. Replace the placeholder argument
sample_data.idc
with the name of your IDC file as
sample_data.idc
file is not provided with the toolbox.
ibeoReader = ibeoFileReader('sample_data.idc')
ibeoReader = ibeoFileReader with properties: FileName: "C:/Documents/MATLAB/ibeo_data/sample_data.idc" StartTime: 15-Mar-2020 11:21:04.999434999 EndTime: 15-Mar-2020 11:25:35.030095000 Duration: 00:04:30 FileSummary: CAN 53 msgs [0x1002] scan 53 msgs [0x2205] object 106 msgs [0x2281] image 53 msgs [0x2403] vehicleState 53 msgs [0x2808] measurementList 53 msgs [0x2821] pointCloudPlane 53 msgs [0x7510] unsupported 53 msgs [0x6120] unsupported 53 msgs [0x6970]
Create an ibeoMessageReader
object, imgReader
,
to read all images in the first 2 minutes, by using the select
function with appropriate message type and time range values.
timeRange = [0, minutes(2)];
imgReader = select(ibeoReader, 'image', timeRange);
Visualize the message data by reading the messages one at a time to a video player
object. First, create a vision.VideoPlayer
object. Then, use the
hasNextMessage
function to check whether
imgReader
contains a message after the current one. If it
does, use readNextMessage
function to read the images into the
workspace.
videoPlayer = vision.VideoPlayer; while hasNextMessage(imgReader) img = readNextMessage(imgReader); step(videoPlayer,img); end release(videoPlayer);
Reset the ibeoMessageReader
object, imgReader
,
to the first message in the selection, using the reset
function.
reset(imgReader);
Input Arguments
msgReader
— Message reader
ibeoMessageReader
object
Message reader, specified as a ibeoMessageReader
object.
Output Arguments
flag
— File selection has subsequent message to read
true
| false
File selection has subsequent message to read, returned as a logical
true
or false
.
Version History
Introduced in R2021a
See Also
ibeoFileReader
| select
| reset
| readNextMessage
| readMessages
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 (한국어)