I am currently working on an S-Function in Simulink, and I encountered the following error:
조회 수: 3 (최근 30일)
이전 댓글 표시
Error: Cannot initialize the width of data type work vector 1 of 'untitled/S-Function'. The data type work vector width is set to dynamically sized (-1). Initialize the data type work vector width in mdlInitializeSizes or mdlSetWorkWidths.
I understand that the issue is related to initializing the width of the data type work vector. However, I am unsure about the steps to resolve this error. Could you please provide guidance on how to initialize the data type work vector width in either mdlInitializeSizes or mdlSetWorkWidths?
댓글 수: 0
답변 (1개)
Ayush Singh
2024년 2월 12일
Hi Ahraz
In order to initialize the width of data type work vector using mdlInitializeSizes try adding this code
static void mdlInitializeSizes(SimStruct *S)
{
% Add mdlInitializeSizes code here *
% Register the number of DWork vectors
ssSetNumDWork(S, 1); % This sets the number of DWork vectors to 1
% Set the width of the first (and only) DWork vector
ssSetDWorkWidth(S, 0, 10); % This sets the width of the first DWork vector to 10
}
Here 'S' is SimStruct representing an S-Function block.
For more information on 'mdlInitializeSizes' , 'ssSetNumDWork' and 'ssSetDWorkWidth' refer to following links:
I hope the above information helps!
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!