Hi, I am currently encoding MATLAB and C. I compiled MATLAB functions into a C library using MATLAB Compiler (mcc), and called functions in a shared library in a C ++ program.
Is it possible to declare a global variable for exchanging data between MATLAB functions when called in C ++?
More precisely, if matlab has a function matlabA()and a function matlabB()and is compiled into a C ++ shared library using the mcc compiler as cppA()well cppB(), can I share a variable between them simply by declaring the variables as global in matlabA()and matlabB()?
It doesn't seem to work, then how can I share a variable between functions?
Thank!
MATLAB
function matlabA()
global foo
foo = 1;
end
function matlabB()
global foo
foo
end
C ++
cppA();
cppB();
source
share