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

1 visualización (últimos 30 días)
Emimal M
Emimal M el 12 de Mayo de 2022
Respondida: T.Nikhil kumar el 29 de Sept. de 2023
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), ...

Respuestas (1)

T.Nikhil kumar
T.Nikhil kumar el 29 de Sept. de 2023
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!

Categorías

Más información sobre Language Support en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by