Problems with Code Generation
Show older comments
Hello all, let me present you my problems with Code Generation and ask you for help or tips. I use Matlab R2013a.
Originally I have one control scheme, but here I attached just the parts which are causing the problems. The goal is to build the Simulink scheme which can be built with Code Generation to C code (for C module on PLC).
Everything in the scheme is built of Simulink blocks, except one function Fuzzyfication, which I’m trying to implement with Matlab Function (which should be OK for Code Generation). If you look at the initialize_extf_w_test.m file, it is just loading/initializing some parameters and simulating the Simulink scheme, where only Fuzzyfication Matlab Function is running.
But this scheme cannot be run, I get the error “Errors occurred during parsing of MATLAB function 'MATLAB Function'(#875)”. I don’t know if number is important, because they are sometimes different, but I also cannot find what it would mean. On the other hand, if I move the function to .m file (fuzzycation.m) and run “codegen fuzzyfication”, it works fine and it builds the C code. Also, if I implement the same code in the level 2 S-function and run the scheme (it is not attached), it works fine.
So, my question is, what could be wrong with running this in Matlab Function? What I’m missing? I know the implementation could be done with C-S functions, but I’m trying to avoid that (Matlab function should be also OK), due to lack of experience in plain C coding.
Thank you for answers, tips, help, etc. in advance. Best regards,
3 Comments
Kaustubha Govind
on 2 Oct 2013
AFAIK, the number (#875) is just an ID assigned to that specific MATLAB Function block. There are typically additional error messages that show up on the pop-up error window. Do you see any messages other than the one you posted? You may also want to scroll down and read the complete message to make sure you're not missing anything.
Aleksander Preglej
on 3 Oct 2013
Aleksander Preglej
on 3 Oct 2013
Accepted Answer
More Answers (0)
Categories
Find more on Algorithm Design Basics in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!