Inheriting from 'matlab.mi​xin.Hetero​geneous' in Coder

6 visualizaciones (últimos 30 días)
Tony Davis
Tony Davis el 27 de Ag. de 2015
Respondida: Walter Roberson el 28 de Ag. de 2015
In MATLAB, inheriting from matlab.mixin.Heterogeneous for the base class will allow nice polymorphism. However, it appears this isn't supported in Coder. First, can anyone confirm that Coder cannot use matlab.mixin.Heterogeneous, and if not, does anyone have a nice workaround.
For instance, I have the usual setup of an ABC called Shape, which is derived from both handle and matlab.mixin.Heterogeneous. Then I have Rectangle and Circle derived from Shape. I'd like to be able to have an array like:
classdef Shape < handle & matlab.mixin.Heterogeneous
classdef Circle < Shape
classdef Rectangle < Shape
harray = [Rectangle(height, width), Circle(radius)];
In Matlab, harray becomes a type "1x2 heterogeneous Shape (Rectangle, Circle) array"
In Coder, I get the error "Base class 'matlab.mixin.Heterogeneous' cannot be loaded." during the build.
Any ideas how this could be approached? Before I do something crazy, I just want to check if there's something obvious I'm missing.

Respuestas (1)

Walter Roberson
Walter Roberson el 28 de Ag. de 2015
Limitations in class support is supposedly documented at http://www.mathworks.com/help/coder/ug/how-working-with-matlab-classes-is-different-for-code-generation.html . Unfortunately I do not have permission to access the document myself.

Categorías

Más información sobre Simulink Coder en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by