Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

To resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016

How do I specify the '.CustomAt​tributes.T​ypeName'

Asked by Craig Barry on 13 Nov 2012

Hi guys,

I have defined a custom storage class. It currently defines the structure as 'Instant specific' (as per the cscdesigner). I then assign variables into the desired structure with an m script which does the following:

wibble.RTWInfo.CustomAttributes.StructName = 'runtime_structname';

When generating code, it comes out looking like this:

extern const runtime_structname_type = *runtime_structname;

This is not what I want to generate, I want to also specify the 'TypeName', as mentioned in the 'csc_registeration.m'. When not set as instant specific the structure type can be defined, but I want to dynamically assign this to make code that looks like this (notice the type does not contain the word runtime):

extern const structname_t = *runtime_structname;

Unfortunately, I cannot access the TypeName class, the following error is generated, "No public field TypeName exists for class"

Does anyone know how I can achieve what I want?

Thanks in advance.

Craig

1 Comment

Craig Barry on 17 Nov 2012

For anyone interested, the workaround for this issue, in handcode I have a script which automates the inclusion of an additional typedef to the required type:

typedef struct structname structname_t;  /* This is the required format */
typedef structname_t runtime_structname_type; /* This typedefs the RTW generated code into my required form */
extern const structname_t *runtime_structname; /* Declare pointer to struct of required type */
Craig Barry

Products

0 Answers

Contact us