use simulation time in c-code
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Akzeptierte Antwort
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Configure Block Features for MATLAB S-Functions finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!