How can I load, read and save ros ".msg" file by Matlab?
19 views (last 30 days)
Show older comments
I am trying to load those Autoware code in to Matlab and create a excel files. Autoware is on ROS. ROS has some massage files. I am trying to load those files by MATLAB and get the output as execel files. For example, I have a ROS .msg file called "AccelCmd.msg". Inside of this message I have something as :
Header header
int32 accel
I am able to open it by duble cleck this from "Current folder" window. Or I can right cleck and choose open it as txt. However, that is not what I want. I want load them and save them as a csv or xsml files. Anyone can help me with it?
Thank you.
0 Comments
Answers (1)
Cam Salzberger
on 21 Jan 2019
Edited: Cam Salzberger
on 22 Jan 2019
Hello David,
If you are simply looking to import the text from ROS message files, then possibly write it back out into a different file format, there are many ways of pulling text into MATLAB. I'd suggest using the Import Tool as a good first step, as you can use it to generate code for later use in automatically importing text. textscan is also useful if you just want to pull all the text in, and parse it to ignore comment and blank lines. If none of the files have comments, you could check out readtable.
Now that is all about how to get the text data into MATLAB. However, most of the time people are looking to do something with ROS MSG files, they are looking to create ROS message objects in MATLAB, and send and receive that type of ROS message from MATLAB to an external network. If you would like to use MATLAB to access data in these messages (whether the messages are in rosbags or received over the ROS network), you can follow the ROS Custom Message workflow to add support for these messages to MATLAB.
Hope that helps!
-Cam
7 Comments
See Also
Categories
Find more on Publishers and Subscribers in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!