Main Content

setAlternateFileSystemRoots

Set alternate file system roots when data source of labeled signal set is a datastore

Since R2022a

Description

setAlternateFileSystemRoots facilitates collaborative data set labeling and analysis. Use setAlternateFileSystemRoots to change the path to signal data in a datastore when you want to access the data in the labeled signal set on different machines.

setAlternateFileSystemRoots(lss,altroots) specifies alternate file system root paths altroots for the source data files in the labeled signal set lss. The function applies only to labeled signal sets whose data source is a datastore that points to files.

Note

The setAlternateFileSystemRoots function overwrites the existing alternate file system roots. To append new alternate roots, use the getAlternateFileSystemRoots function to get the current roots, append the new roots to the current array, then set the extended array with setAlternateFileSystemRoots.

example

Examples

collapse all

Create a labeledSignalSet to store labels for electromyographic (EMG) signals and set alternate file paths to access the data on a different machine. Download the data set from this location: https://ssd.mathworks.com/supportfiles/SPT/data/MyoelectricData.zip.

Use a signalDatastore to manage the EMG files. Modify folder to correspond to the location where you download the files. The data set is organized into subfolders, so enable the IncludeSubfolders flag.

folder = "C:\path\Data";
sds = signalDatastore(folder,IncludeSubfolders=true);

The data set contains signal data and index files, appended by "d.mat" and "i.mat", respectively. Create a subset of the datastore that includes only the signal data files.

listing = dir(append(sds.Folders{1},"\**\*.mat"));
files = {listing(:).name}';
idx = contains(files,"d.mat");
subds = subset(sds,idx);

Use the subset datastore as the data source for a labeledSignalSet object. You can import the labeled signal set into Signal Labeler to interactively label the signal data, or use addLabelDefinitions to add labels to the labeled signal set at the command line.

lss = labeledSignalSet(subds);

To continue labeling the data on a different machine, or share the labeled signal set with another user, identify the root paths for the EMG data on your local machine and the second machine. Set the alternate file paths so that you can read the data on the second machine.

altroots = ["C:\path\Data" "C:\secondpath\Data"];
setAlternateFileSystemRoots(lss,altroots)

Input Arguments

collapse all

Labeled signal set, specified as a labeledSignalSet object. The function updates the file paths of the underlying datastore source if the current paths do not exist. The function applies only to labeled signal sets whose data source is a datastore that points to files.

Alternate file system roots, specified as a string array or cell array. altroots contains one or more rows, where each row specifies a set of equivalent root paths.

Example: ["Z:\datasets" "/mynetwork/datasets"]

Example: {["Z:\datasets" "/mynetwork/datasets"];["Y:\datasets" "/mynetwork2/datasets" "S:\datasets"]}

Version History

Introduced in R2022a