Why are extra C++ classes being generated from my MATLAB Code?
1 view (last 30 days)
Show older comments
我定义了一个MATLAB类和两个入口点functions that call members of it. The output of the first function is an instance of the class and is used as an argument to the second function. When I generate code, I expect to see a single C++ class that mimics the structure of the MATLAB class. Instead, I see an extra class being generated, with a 'b_' prepended to its name. Why does this happen?
Accepted Answer
MathWorks Support Team
2021年2月19日
Edited:MathWorks Support Team
2021年2月19日
One possible reason for this is that the input of the second function and the output of first function are not explicitly connected in the MATLAB Coder app. Therefore, these two arguments are treated as two separate class types. Make sure to establish the relationship between the two using coder.OutputType function or in the MATLAB Coder app, click the input of the 2nd function and choose "Use output" then choose the output of the first function.
In the "Define Input" stage, choose "Use output".
Choose the output of the first function.
0 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!