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

1 view (last 30 days)
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 Comments
Adam Danz
Adam Danz on 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 on 30 Nov 2018
Thank you. The error is : undefined function or variable 'saveCompactModel'(or 'learnerCoderConfigurer') depending on the one i'm using

Sign in to comment.

Answers (1)

Adam Danz
Adam Danz on 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.

Categories

Find more on MATLAB Coder in Help Center and File Exchange

Products


Release

R2016a

Community Treasure Hunt

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

Start Hunting!