Usage of addUserDataType to register custom type
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
I'm using 2012a Windows 7 64-bit
I'd like to use our custom data types in any new model. After reading the help section "Using User-Defined Data Types for Code Generation", I tried to register the custom data types using the suggested sl_customization.m file.
File contents:
function sl_customization(cm)
% SL_CUSTOMIZATION to register the ####s custom data types
%
% Get default (factory) customizations
hObj = cm.slDataObjectCustomizer;
% Register Real-Time Workshop build process hooks
addUserDataType(hObj, 'bool_t', 'boolean', '"_types.h"');
addUserDataType(hObj, 'int8_t', 'int8', '"_types.h"');
addUserDataType(hObj, 'uint8_t', 'uint8', '"_types.h"');
addUserDataType(hObj, 'int16_t', 'int16', '"_types.h"');
addUserDataType(hObj, 'uint16_t', 'uint16', '"_types.h"');
addUserDataType(hObj, 'int32_t', 'int32', '"_types.h"');
addUserDataType(hObj, 'uint32_t', 'uint32', '"_types.h"');
However, when the script is executed, the following message is returned and the custom types are not available to signal typing.
Warning: Invalid input arguments for addUserDataType.
> In warning at 30
In C:\Program Files\MATLAB\R2011b\toolbox\simulink\simulink\@mpt\@SLDataObjectCustomizer\addUserDataType.p>addUserDataType at 83
In sl_customization at 10
In sl_refresh_customizations>call_all at 155
In sl_refresh_customizations at 78
Where can I find the API definition for sl* objects?
Thanks for your time.
1 Commento
Walter Roberson
il 15 Giu 2012
I really don't know if this will help, but see http://www.mathworks.de/matlabcentral/answers/32431-sl_customization
Risposte (1)
Kaustubha Govind
il 21 Giu 2012
I think the error may be because bool_t, int8_t, etc. are reserved keywords (these names are exactly what Simulink Coder uses for built-in types in order to achieve platform-independence). You need to use different names for custom types.
0 Commenti
Vedere anche
Categorie
Scopri di più su Deployment, Integration, and Supported Hardware in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!