Make static variables in mex keep their values between calls
Show older comments
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 Comment
James Tursa
on 21 Aug 2020
Edited: James Tursa
on 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.
Accepted Answer
More Answers (0)
Categories
Find more on Write C Functions Callable from MATLAB (MEX Files) in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!