PCAP to .MAT (want to use PCAP in Examples)
14 views (last 30 days)
Show older comments
i am currently using velodyne VLP16 and most of the work is done in PCAP file.
i have tried some matlab examples with PCAP file and they are really good but there are some examples that uses .mat file instead of pcap.
can any one help me in using PCAP in those examples or how can i convert PCAP to .mat or even how can i get .mat file using velodyne VLP16.
i am trying to use https://www.mathworks.com/help/driving/examples/ground-plane-and-obstacle-detection-using-lidar.html#driving-ex69316687
thanks,
5 Comments
Akshay Gupta
on 13 Apr 2022
Hello, can we save above mentioned converted MATLAB file into pcap file again?
As I have transfromed the point from pcap file frame by frame and save it in matrix/ or matlab file.
But I need to convert it to pcap file again.
Please suggest the solution for this.
Thanks
Answers (1)
Paola Donis Noriega
on 29 Oct 2025 at 14:11
Hi Abdullah,
You can read point clouds from a PCAP file and store them as an array of pointCloud objects. Then, you can save this array to a MAT file. For example:
% Create a reader object for the PCAP file.
veloReader = velodyneFileReader('lidarData_ConstructionRoad.pcap','HDL32E');
% Preallocate an array to hold each point cloud frame.
numFrames = veloReader.NumberOfFrames;
ptCloudArr = repmat(pointCloud(zeros(0, 3)),numFrames,1);
for i = 1:numFrames
% Read each frame and store it in the array.
ptCloudArr(i) = readFrame(veloReader,i);
end
% Save the array of point clouds to a MAT file.
save("velodyneData.mat","ptCloudArr")
Note: MATLAB does not support writing point clouds to PCAP files. To export point clouds, you can use the pcwrite function to save each point cloud to a PLY or PCD file.
0 Comments
See Also
Categories
Find more on Point Cloud Processing 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!