Main Content


Change file paths in ground truth data



unresolvedPaths = changeFilePaths(gTruth,alternativePaths) changes the file paths in a groundTruthLidar object gTruth based on the specified pairs of current paths and alternative paths alternativePaths. If gTruth is a vector of groundTruthLidar objects, the function changes the file paths across all objects. The function returns the unresolved paths in unresolvedPaths. An unresolved path is any current path in alternativePaths not found in gTruth or any alternative path in alternativePaths not found at the specified path location. In both cases, unresolvedPaths returns only the current paths.


collapse all

Change the file paths to the data sources in a groundTruthLidar object.

Load a groundTruthLidar object containing multiple labels of groups, types and names into the workspace. The data source contains the file paths corresponding to the point cloud sequence showing multiple vehicles. MATLAB® displays a warning that the path to the data source cannot be found.

Warning: The data source for the following source names could not be loaded. C:\Source

Display the current path to the data source.

ans = 
  PointCloudSequenceSource with properties:

            Name: "Point Cloud Sequence"
     Description: "A PointCloud sequence reader"
      SourceName: "C:\Source"
    SourceParams: [1×1 struct]
      SignalName: "Source"
      SignalType: PointCloud
       Timestamp: {[0 sec]}
      NumSignals: 1

Specify the current path to the data source and an alternative path and store these paths in a cell array. Use the changeFilePaths function to update the data source path based on the paths in the cell array.

The function updates the paths for all labels. As the function resolves all paths, it returns an empty array of unresolved paths.

currentPathDataSource = "C:\Source";
newPathDataSource = fullfile(matlabroot, 'toolbox', 'lidar', 'lidardata');
alternativeFilePaths = {[currentPathDataSource newPathDataSource]};
unresolvedPaths = changeFilePaths(gTruth, alternativeFilePaths)
unresolvedPaths =


To view the new data source path, use the gTruth.DataSource command.

Input Arguments

collapse all

Ground truth lidar data, specified as a groundTruthLidar object or vector of groundTruthLidar objects.

Alternative file paths, specified as a two-element row vector of strings or cell array of two-element row vectors of strings, where each vector is of the form [pcurrent pnew].

  • pcurrent is a current file path in gTruth. This file path can be from the data source or pixel label data of the gTruth input. Specify pcurrent using backslashes as the path separators.

  • pnew is the new path to which to change pcurrent. Specify pnew using either forward slashes or backslashes as the path separators.

You can specify alternative paths to signal data sources. The DataSource property of gTruth contains one groundTruthLidar object per signal. The changeFilePaths function updates the signal paths stored in these objects.

If gTruth is a vector of groundTruthLidar objects, the function changes the file paths across all objects.

Output Arguments

collapse all

Unresolved file paths, returned as a string array. If the changeFilePaths function cannot find either the specified current path in the gTruth input or the specified new path in the specified path location, then it returns the unresolved current path.

If the function finds and resolves all file paths, then it returns unresolvedPaths as an empty string array.

Introduced in R2020b