Question
I'm using L515 Lidar for data collection, I'm getting data .bag format from Realsense Viewer . I need to convert to .pcd format, How can I achieve that using Matlab ?
Expert Answer
John Williams
PhD Expert
Answered Aug 26, 2026
To achieve this with MATLAB, you would need both ROS Toolbox license and Computer Vision Toolbox license. You can check whether you have these with:
>> ver
If you have both licenses, you can follow these steps and examples to read from .bag format, convert to point cloud, and save to .pcd format:
- Read .bag files with rosbagreader, this example shows how to read specific message from the .bag file. You would need to select the topic that correspond to the sensor_msgs/PointCloud2 message in .bag file.
- Use rosReadXYZ (and rosReadRGB if you also want the color of the point cloud) from each of those ROS messages.
- Use pointCloud to create pointCloud objects in MATLAB.
- Save those pointCloud objects to .pcd filie with pcwrite.
Hope this helps,
100% Run Guarantee
3-Hour Fast-Track Delivery
Need a Custom Version or Complete Simulation for This Problem?
Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.
Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here
Related lidar Questions & Solutions
Browse All →
Explore similar technical troubleshooting questions and verified MATLAB solutions:
Ready-to-Run MATLAB & Simulink Projects
Browse All Projects →