フィルターのクリア

I am currently working on an S-Function in Simulink, and I encountered the following error:

9 ビュー (過去 30 日間)
AHRAZ
AHRAZ 2024 年 2 月 8 日
回答済み: Ayush Singh 2024 年 2 月 12 日
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?

回答 (1 件)

Ayush Singh
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!

製品


リリース

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by