Cannot load an object of class 'ClassificationKNN': Its class cannot be found in compiled executable
Afficher commentaires plus anciens
Hi folks,
I try load load an object of ClassificationKNN from a mat file. Which works with no issues from the MATLAB Deskop.
If I compile the program using mcc -m program.m the above error occurs when I try to load the mat file:
Warning: Cannot load an object of class 'ClassificationKNN':
Its class cannot be found.
I tried the function pragma: '#function ClassificationKNN', now I get a different error:
The file
'C:\Program Files\MATLAB\R2019b\toolbox\stats\mlearnapp\+mlearnapp\+internal\+model\DatasetSpecification.m'
is not in the application's expanded CTF archive at
'C:\Users\...
This is typically caused by calls to ADDPATH in your startup.m or matlabrc.m files. Please see the compiler documentation and use the ISDEPLOYED function to ensure ADDPATH commands are not executed by deployed applications.
I should say, that I dont do anything with ADDPATH.
I also tried to create a dummy object:
Model = fitcknn(table(1,1), 1);
but i get the same error.
I tested this with 2019b and workaround for 2019b would be required.
Thanks
Michael
Réponses (1)
Image Analyst
le 11 Avr 2022
It's probably caused by you not specifying the complete path of your .mat file.
See the FAQ:
Alternatively you can omit the folder of the mat file, when you call load() in your source code, if you include it with the -a option of mcc:
mcc -m program.m -a mymatfile.mat
2 commentaires
Michael Budach
le 12 Avr 2022
Modifié(e) : Michael Budach
le 12 Avr 2022
Image Analyst
le 12 Avr 2022
You aren't trying to all an applet, like RegressionLearner, from your app are you? Because mini-programs like that are not allowed to be built into programs.
I'm not sure why loading a .mat file, which is basically just data, would cause it to try to run an m-file. Do you know what that DatasetSpecification.m file is or does?
Do you have any calls to cd or addpath in your source code?
You can call tech spport for help. I assume since you have the very expensive compiler toolbox you also have an active software maintenance agreement in place.
Catégories
En savoir plus sur Standalone Applications dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!