Usage of addUserDataType to register custom type
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
Walter Roberson
2012-6-15
I really don't know if this will help, but see http://www.mathworks.de/matlabcentral/answers/32431-sl_customization
回答(1 个)
Kaustubha Govind
2012-6-21
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Deployment, Integration, and Supported Hardware 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!