How to rectify 'undefined function or variable'. errors. in code generation

1 vue (au cours des 30 derniers jours)
boluwatife adelowo
boluwatife adelowo le 30 Nov 2018
I am currently working on a svm project. I have created my model and it's working well. I tried to generate the C code for the model using 'learnerCoderConfigurer' and 'saveCompactModel' but I'm getting errors 'undefined function or variable'. Attached is a copy of my code.
  2 commentaires
Adam Danz
Adam Danz le 30 Nov 2018
Your question is impossible for us to answer without more infomration.
The error your getting means exactly what it states: you have a variable or a function in your code that is undefined.
You're loading variables (and/or functions) at the beginning of your code and we can't see what you're loading so there's no way for us to know what is undefined in your code.
Fortunately, matlab also tells you the line of your code that is causing the problem and it even tells you the exact item that is undefined. However, you haven't shared that information with us.
If you provide the full error message that would be a good start.
boluwatife adelowo
boluwatife adelowo le 30 Nov 2018
Thank you. The error is : undefined function or variable 'saveCompactModel'(or 'learnerCoderConfigurer') depending on the one i'm using

Connectez-vous pour commenter.

Réponses (1)

Adam Danz
Adam Danz le 30 Nov 2018
In your attached sample of code, given the error message, "saveCompactModel" seems to be a function and matlab doesn't have access to it.
If you're sure the function exists, add its directory to the search path using addpath().
The same is probably true for the learnerCoderConfigurer function.

Catégories

En savoir plus sur MATLAB Coder dans Help Center et File Exchange

Produits


Version

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by