Defining structure names in generated code

Hello,
I recently updated Matlab from R2013b to R2018a and have been looking at the changes in generated code from Matlab Coder. One thing I have noticed is a slight change in the generated structure name and so I was wondering if this can be controlled? I presumed there might be something in the Model Configuration Parameter settings, but can't see what I am looking for.
Many Thanks.

Antworten (1)

Ji Lee
Ji Lee am 1 Okt. 2018

0 Stimmen

Control of struct names in generated code is achieved using coder.cstructname in MATLAB Coder.
v = struct('a',1,'b',2);
coder.cstructname(v, 'myStruct');
For complete information about coder.cstructname, please have a look here: https://www.mathworks.com/help/coder/ref/coder.cstructname.html

3 Kommentare

Ross
Ross am 11 Okt. 2018
Thanks Ji Lee,
So this is not something which can be defined in the model configuration or any other settings from what I understand?
Hi Ross,
Please let us know if you are trying to generate code from MATLAB or Simulink. Your question mentions MATLAB Coder but this comment mentions about the model configuration.
The answer Ji Lee provided is specific to MATLAB to C Code conversion using MATLAB Coder.
Ross
Ross am 29 Okt. 2018
Hi Darshan,
Yeah I probably used the wrong tag, I am generating code from a Simulink model.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu MATLAB Coder finden Sie in Hilfe-Center und File Exchange

Produkte

Version

R2018a

Gefragt:

am 1 Okt. 2018

Kommentiert:

am 29 Okt. 2018

Community Treasure Hunt

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

Start Hunting!

Translated by