Code generation with ordered data structures of objects e.g. lists or vectors of objects
4 views (last 30 days)
Show older comments
Marcus Mårdberg on 2 Jun 2020
Commented: Marcus Mårdberg on 3 Jun 2020
we have a problem that lend itself well to an object oriented approach, specifically we need to be able to generate C++ code using Matlab Coder/Embedded Coder with Matlab source code containing ordered datastructures of objects, e.g. lists or vectors of instantiated classes (objects) or lists or vectors of references to objects.
What is the state of Matlab code generation regarding this issue, is this possible in Matlab 2020a? If not, I would like to put this on a wishlist if it is not already on there. For us this is a highly desirable feature when working with object orientation.
Denis Gurchenkov on 2 Jun 2020
As of R2020a, MATLAB Coder supports cell array of value objects, which get converted to arrays of struct in C and arrays of classes in C++. If your objects are handle objects, coder only supports fixed-size cell arrays of those.
Support of arrays of objects, including variable-sized arrays, arrays with pointers/references etc is top priority feature that MATLAB Coder development team is working on. If you have specific examples that you'd like to contribute so that the design of this feature is influenced by your input, please feel free to attach here, or pass those to the development team by contacting MathWorks technical support (just tell the support person you'd like to request this feature and ask them to pass the example to the development team).
Find more on Simulink Coder in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!