select

Select subset of messages in rosbag

Syntax

bagsel = select(bag)
bagsel = select(bag,Name,Value)

Description

example

bagsel = select(bag) returns an object, bagsel, that contains all of the messages in the BagSelection object, bag

This function does not change the contents of the original BagSelection object. It returns a new object that contains the specified message selection.

example

bagsel = select(bag,Name,Value) provides additional options specified by one or more Name,Value pair arguments.

Examples

collapse all

Retrieve the rosbag. Specify the file path.

bag = rosbag('ex_multiple_topics.bag');

Use select with no selection criteria to create a copy of the rosbag.

bagCopy = select(bag);

Retrieve the rosbag. Specify the file path.

bag = rosbag('ex_multiple_topics.bag');

Select all messages within the first second of the rosbag.

bag = select(bag,'Time',[bag.StartTime,bag.StartTime + 1]);

Input Arguments

collapse all

Messages contained within a rosbag, specified as a BagSelection object.

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside quotes. You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example: "MessageType","/geometry_msgs/Point"

ROS message type, specified as a string scalar, character vector, or cell array. Multiple message types can be specified with a cell array.

Start and end times of the rosbag selection, specified as an n-by-2 vector.

ROS topic name, specified as a string scalar, character vector, or cell array. Multiple topic names can be specified with a cell array.

Output Arguments

collapse all

Copy or subset of rosbag messages, returned as a BagSelection object

Introduced in R2015a