- Define a structure to hold the instance-specific data for each block instance. This structure will include the global variable and any other relevant information.
- Use the S-Function's 'mdlInitializeSizes' function to allocate memory for the instance-specific data structure for each block instance.
- Use the S-Function's 'mdlOutputs' or 'mdlUpdate' functions to access and manipulate the instance-specific data as needed.
How can i maintain different variable(global) for multiple instances of same block.
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I have generated a library.
Integrated external c function using s-function builder.
Different instances of the custom block operates on a single global variable. My requirement needs to maintain separate global variable for multiple instances.
How can i get that to work?
Using R2020b
0 Commenti
Risposte (1)
Rishav
il 19 Feb 2024
Hi Anamika,
You can use Simulink's S-Function API to manage instance-specific data. Please follow the below mentioned steps to achieve the same:
You can also refer to the below mentioned documentations on:
0 Commenti
Vedere anche
Categorie
Scopri di più su Simulink Coder in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!