Why are extra C++ classes being generated from my MATLAB Code?

I have defined a MATLAB Class and two entry point 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?

 采纳的回答

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 个)

产品

版本

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by