timeseries

Creates a time series object for selected message properties

Syntax

[ts,cols] = timeseries(bag)
[ts,cols] = timeseries(bag,property)
[ts,cols] = timeseries(bag,property,...,propertyN)

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 rosbag. Specify the file path.

bag = rosbag('ex_multiple_topics.bag');

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

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

Create time series for the '/odom' topic.

ts = timeseries(bagSelection);

Load rosbag. Specify the file path.

bag = rosbag('ex_multiple_topics.bag');

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

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

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

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

Load rosbag. Specify the file path.

bag = rosbag('ex_multiple_topics.bag');

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

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

Create 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.

See Also

| |

Topics

Introduced in R2015a