use simulation time in c-code
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I am trying to write an s-function in C-code (to have a better simulation performance). In my simulink model I created first I inserted a clock because my function depends on the current simulation time. With which command can I get the current simulation time in my C-code without having to use an extra inport for the clock in my s-function block?
I am looking for a code like *mxGetPr(mexGetVariable("base", array_name)) which reads in the variable I have in my workspace, but than in this case I would like to read in the simulation time or simulation time step (simulation time not starting from zero so these are not the same and the latter would be the easiest for future use in my code)
I have tried using ssGetSampleTime(S, 0) and ssGetInputPortOffsetTime(S, 0) but both did not work (return 0 when I write it to output). Any thoughts on why not?
0 Commenti
Risposta accettata
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Configure Block Features for MATLAB S-Functions in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!