Make static variables in mex keep their values between calls
Ältere Kommentare anzeigen
I want to integrate external C code consisting of multiple functions and files using simple wrapper function
function out = callExternalCFunction(data_in)
out = coder.ceval('externalCfunction', data_in);
end
and build a MEX file.
I noticed that static variables declared in the external C code do not retain their values between MEX calls. Can I control this behaviour somehow?
1 Kommentar
James Tursa
am 21 Aug. 2020
Bearbeitet: James Tursa
am 22 Sep. 2020
Can you provide simple example code? Static variables should retain their values as long as you don't clear the mex routine from memory and you don't have code that always re-initializes their values when the mex routine is called.
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Write C Functions Callable from MATLAB (MEX Files) finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!