Clear Filters
Clear Filters

Load Signal Data from mat files for Training of neural network

4 views (last 30 days)
I have a dataset of signals with n*2 dimension. I want to make a datastore for it by assigning the labels from the sources. I have used fileDatastore but it does not support LabelSource argument as it is supported in imageDatastore.
Any help will be appreciated.

Answers (1)

Ruchika
Ruchika on 31 Jul 2023
Hi, based on my understanding, you have a dataset of signals with dimensions n*2, and you want to create a datastore for this dataset by assigning labels from the sources. To clarify, fileDatastore is normally used to read collections of files, but imageDatastore is made to handle image data and has features like the LabelSource argument for giving the photos labels. In your situation, you may need to take a different route to establish a datastore with labels as your dataset consists of signals rather than images. Use MATLAB's datastore function to build a custom datastore by supplying the read and write routines as well as the labels for each signal as one option.
If you have a dataset of signals with n*2 dimensions and you want to create a datastore with corresponding labels from the sources, you can use the matlab.io.datastore.DsFileSet object to achieve this.
% Create a DsFileSet object with the signal files and labels
fileSet = matlab.io.datastore.DsFileSet(dataPath, 'FileExtensions', '.mat', 'Labels', labels);
% Replace dataPath with the actual path to your signals dataset
% Replace labels with the array that stores the labels extracted from the signal files in the dataset.
% Create a datastore using the DsFileSet object
datastore = matlab.io.datastore.FileDatastore(fileSet);
To learn more about collection of files in datastore, please check out the MathWorks documentation links below:

Community Treasure Hunt

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

Start Hunting!