Clear Filters
Clear Filters

Issue loading file in LiDAR labeler using custom point cloud reader

2 views (last 30 days)
I am trying to use MATLAB's lidar labeler app to manually label some ground truth data. The lidar data I have is stored in a custom format, and I would like to use my own ground removal algorithm. So I chose to use the 'Custom Point Cloud' option as detailed here.
regardless of the sourcename I try to give it, the function call shown below,
lidarLabeler(sourceName,@FunctionHandle,timestamps);
results in the following error: "filename" must be a string scalar or character vector. Error in lidar.internal.lidarLabeler.lidarLabelerInternal
To ensure sourceName is of the proper data type, I tried doing the following:
fileFilter = '*.pcap';
[File_name,Directory]= uigetfile(fileFilter,'Open a .pcap file');
fileName = [Directory File_name];
and I tried passing fileName to the lidar labeLabeler and still have the same issue. Please advise on how to properly pass the file name to lidar labeler?

Accepted Answer

Vijeta
Vijeta on 14 Jun 2023
Edited: Vijeta on 14 Jun 2023
Hi,
Based on the error you are receiving, it appears that the sourceName input argument in lidarLabeler(sourceName, @FunctionHandle, timestamps) must be a string scalar or character vector. This means that you must pass a file name as a string or character vector, rather than a variable containing a file name.
In the code snippet you provided, you are correctly using uigetfile to open a file and obtain its name as a string. However, it looks like you are combining the directory and file name using square brackets (fileName = [Directory File_name];) which results in a character array, not a string scalar. Instead, you should use fullfile to concatenate directory and file name as a string:
[fileName, directory] = uigetfile(fileFilter, 'Open a .pcap file');
sourceName = fullfile(directory, fileName);
This will create a string scalar with the full path to the file, which you can then pass to the lidarLabeler function.
Note that the fullfile function takes care of the appropriate separator character for the platform you are working on (e.g., '' on Windows, '/' on Linux/Mac), so you don't need to manually add it or worry about platform-specific issues.
You can refer to these resources
  1 Comment
Vamsi Krishna Bandaru
Vamsi Krishna Bandaru on 18 Jul 2023
@Vijeta, Thank you for the reply. The solution you provided works for any file in the local drive of a windows computer. When i tried to point to a file that is stored on a network drive, i receive the same error : "sourceName" must be a string scalar or character vector.

Sign in to comment.

More Answers (0)

Products


Release

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!