timeseries

Creates a time series object for selected message properties

Description

example

[ts,cols] = timeseries(bag) creates a time series for all numeric and scalar message properties. The function evaluates each message in the current BagSelection object, bag, as ts. The cols output argument stores property names as a cell array of character vectors.

The returned time series object is memory-efficient because it stores only particular message properties instead of whole messages.

example

[ts,cols] = timeseries(bag,property) creates a time series for a specific message property, property. Property names can also be nested, for example, Pose.Pose.Position.X for the x-axis position of a robot.

example

[ts,cols] = timeseries(bag,property,...,propertyN) creates a time series for a range-specific message properties. Each property is a different column in the time series object.

Examples

collapse all

Load the rosbag. Specify the file path.

bag = rosbag('ex_multiple_topics.bag');

Select a specific topic. Time series supports only single topics.

bagSelection = select(bag,'Topic','/odom');

Create a time series for the '/odom' topic.

ts = timeseries(bagSelection);

Load the rosbag. Specify the file path.

bag = rosbag('ex_multiple_topics.bag');

Select a specific topic. Time series support only single topics.

bagSelection = select(bag,'Topic','/odom');

Create a time series for the 'Pose.Pose.Position.X' property on the '/odom' topic.

ts = timeseries(bagSelection,'Pose.Pose.Position.X');

Load the rosbag. Specify the file path.

bag = rosbag('ex_multiple_topics.bag');

Select a specific topic. Time series support only single topics.

bagSelection = select(bag,'Topic','/odom');

Create a time series for all the angular 'Twist' properties on the '/odom' topic.

ts = timeseries(bagSelection,'Twist.Twist.Angular.X', ...
          'Twist.Twist.Angular.Y', 'Twist.Twist.Angular.Z');

Input Arguments

collapse all

Bag selection, specified as a BagSelection object handle. You can get a bag selection by calling rosbag.

Property names, specified as a string scalar or character vector. Multiple properties can be specified. Each property name is a separate input and represents a different column in the time series object.

Output Arguments

collapse all

Time series, returned as a Time object handle.

List of property names, returned as a cell array of character vectors.

Introduced in R2019b