Am trying to train the japanese vowels data in matlab.....

3 次查看(过去 30 天)
Hi, am trying to train the example data, 'japanese vowels data'. Upon previewing the fdsLabelTrain i get the following error. Am attaching the code and error alongwith... plz help me to get out from it....
filename = "japaneseVowels.zip";
outputFolder = fullfile(tempdir,"japaneseVowels");
unzip(filename,outputFolder);
folderTrain = fullfile(outputFolder,"Train");
fdsPredictorTrain = fileDatastore(folderTrain, ...
'ReadFcn',@load, ...
'IncludeSubfolders',true);
preview(fdsPredictorTrain)
ans = struct with fields:
X: [12×20 double]
classNames = string(1:9);
fdsLabelTrain = fileDatastore(folderTrain, ...
'ReadFcn',@(folderTrain) readLabel(folderTrain,classNames), ...
'IncludeSubfolders',true);
preview(fdsLabelTrain)
Error using matlab.io.datastore.FileDatastore/preview
Error using PreviewFcn @(folderTrain)readLabel(folderTrain,classNames) for file:

/tmp/japaneseVowels/Train/1/observation1.mat

Undefined function 'readLabel' for input arguments of type 'string'.

Error in solution (line 11)
'ReadFcn',@(folderTrain) readLabel(folderTrain,classNames), ...

回答(1 个)

T.Nikhil kumar
T.Nikhil kumar 2023-9-29
Hey Emimal,
I understand that you are facing an error with the “readLabel” function while creating a “fileDatastore” type object to store the “Japanese vowels data” folder.
The error message shown points out that the function readLabel is undefined for input arguments of type 'string'. This tells that MATLAB is not able to locate the custom “read” function (readLabel) you are trying to use for your “fileDatastore.
I would suggest you to recheck if you have created a function called “readLabel” in the same folder as your current script or the folder containing the function is added to the MATLAB path. Also, ensure that the “readLabel” function can accept arguments of the type “string”.
You can refer to the “@fcn” input argument section in following documentation to know more about defining a custom read function for “fileDatastore.
I hope this helps!

类别

Help CenterFile Exchange 中查找有关 Language Support 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by