필터 지우기
필터 지우기

Usage of addUserDataType to register custom type

조회 수: 1 (최근 30일)
Tim
Tim 2012년 6월 15일
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
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
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.

카테고리

Help CenterFile 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!

Translated by