I am currently working on an S-Function in Simulink, and I encountered the following error:
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposte (1)
Ayush Singh
il 12 Feb 2024
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 Commenti
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!