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

조회 수: 1 (최근 30일)
boluwatife adelowo
boluwatife adelowo 2018년 11월 30일
답변: Adam Danz 2018년 11월 30일
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
Adam Danz
Adam Danz 2018년 11월 30일
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 2018년 11월 30일
Thank you. The error is : undefined function or variable 'saveCompactModel'(or 'learnerCoderConfigurer') depending on the one i'm using

댓글을 달려면 로그인하십시오.

답변 (1개)

Adam Danz
Adam Danz 2018년 11월 30일
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.

카테고리

Help CenterFile Exchange에서 MATLAB Coder에 대해 자세히 알아보기

제품


릴리스

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by