www.gusucode.com > robotics 案例源码程序 matlab代码 > robotics/RetrieveInformationFromRosbagExample.m

    %% Retrieve information from rosbag

%%
% Set the path to a rosbag file.
filePath = fullfile(fileparts(which('ROSWorkingWithRosbagsExample')), 'data', 'ex_multiple_topics.bag');
%%
% Retrieve information from the rosbag
bagselect = rosbag(filePath);
%%
% Select a subset of the messages, filtered by time and topic.
bagselect2 = select(bagselect, 'Time', ...
[bagselect.StartTime bagselect.StartTime + 1], 'Topic', '/odom');