Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using System function in Matlab is not working

Tags:

system

matlab

I encountered a very strange problem when using the SYSTEM function to call an executable file from Matlab.

First, I can run the executable file in a window console with no problem. However, when I call system(foo.exe) in Matlab, it does nothing but return the status value -1.0737e+09, and it does not throw any warnings or errors.

I am using Matlab R2009b on a 32-bit windows system and the executable file depends on OpenCV2.40.

The system path variable definitely include all the required lib directories. I also tried adding the relevant paths in the LD_LIBRARY_PATH, and copying the dlls in the working directory. These attempts do not change anything.

I also tried calling SYSTEM('cmd') from Matlab, and running the executable in the invoked window console. It gave me no response, either. It seems like the running environment of the console called from Matlab is different from the original window console.

Running the same code on a different machine in Matlab is successful.

like image 342
jimmie33 Avatar asked May 28 '26 06:05

jimmie33


1 Answers

I had this exact same problem. It turned out I simply needed to restart Matlab. I had not restarted Matlab after installing OpenCV2.1.

like image 195
summerstay Avatar answered May 31 '26 08:05

summerstay