Hello,
I have noticed that when I use setenv in MATLAB on Windows, the change is not visible in MEX functions. The behavior is as I would expect on Linux. I tested the following MEX function on MATLAB 2011a and 2012a:
#include <mex.h>void mexFunction(int nargout, mxArray *pargout [ ], int nargin, const mxArray *pargin[]){ printf("OS %s\n", getenv("OS")); printf("AAA %s\n", getenv("AAA"));}
When I run test from MATLAB comandline I get
>> test OS Windows_NT AAA (null)
I get exactly the same when I setenv('AAA') to some value:
>> setenv('AAA','BBB')>> getenv('AAA')ans =BBB>> testOS Windows_NTAAA (null)
Is that a feature, or is it a bug?
Thanks a lot!
Marcin
Best Answer