can not connect the matlab box to matlab engine ?

Concerning processing components: filters, file load/save, visualizations, communication ...
Post Reply
kiyarash
Posts: 27
Joined: Tue Apr 11, 2017 10:44 am

can not connect the matlab box to matlab engine ?

Post by kiyarash »

hi , I'm trying to make the matlab box work to show me a graphic interface.I have windows 10 64bit / matlab 2011a 32 bit

1. my matlab.exe path is "A:/Program Files (x86)/MATLAB/R2011a/bin/matlab.exe" and I set "Path to Matlab executables " in the properties of the box to it .

2. my function is in the path "C:\Users\kiyarash\Desktop\project" so I set "Matlab working directory" to it .

my whole scenario is the single matlab box . but when I run it OV gives the error

"[ ERROR ] At time 0.000 sec <Box algorithm::(0x000068b5, 0x00002500) aka Matlab Scripting> First call to the MATLAB engine failed.
To use this box you must have MATLAB (32 bits version) installed on your computer.
[ ERROR ] At time 0.000 sec <Box algorithm::(0x000068b5, 0x00002500) aka Matlab Scripting> Could not open the Matlab engine.
The matlab binary path was reasoned to be 'A:\Program Files (x86)\MATLAB\R2011a\bin\'.
[WARNING] Box algorithm <Matlab Scripting> has been deactivated because initialize() function returned error
"

I have read the "Tutorial – Level 2 – Using Matlab with OpenViBE" at some part it says :
Compiling the ‘plugins/processing/matlab’ project

A valid installation of MATLAB includes all the libraries and exe required to compile and use the boxes.

To be precise, CMake looks for the following libraries when compiling OpenViBE:

On Windows : libmex.lib, libmx.lib, libeng.lib under ${Matlab_ROOT}/extern/lib/win32/microsoft/
On Linux : mex, mx, eng, under ${Matlab_ROOT}/bin/glnx86 or ${Matlab_ROOT}/bin/glnxa64
so I have checked the "${Matlab_ROOT}/extern/lib/win32/microsoft/" directory and all the three .lib files are there .

but i have not given the box the path to my matlab root wich is "A:/Program Files (x86)/MATLAB/R2011a" only the path to matlab.exe is this the problem ? what am I doing wrong ?

jtlindgren
Posts: 775
Joined: Tue Dec 04, 2012 3:53 pm
Location: INRIA Rennes, FRANCE

Re: can not connect the matlab box to matlab engine ?

Post by jtlindgren »

Hi Kiyarash,

the Matlab init issues are always tricky to solve because the function from mathworks returns no diagnostics
information. We're basically doing a blackbox call, either it works or it doesn't. But we don't know why it
fails when it does (if anybody knows some way to get it to tell what went wrong, I'd be happy to know).

That said, you can try to use a tool like Process Explorer, Filemon or such to find out what files its
trying to access. Sometimes you can notice it failing to find some specific file and that might turn
out to be the reason. However, in case of matlab it might as well be just an internal issue, like
failure to get a license.

Also remember in OV all paths should be specified as '/', the '\' has a different meaning. But I doubt
that could be the reason.

In any case, please let us know if you get it to work what solved it.


Best,
Jussi

kiyarash
Posts: 27
Joined: Tue Apr 11, 2017 10:44 am

Re: can not connect the matlab box to matlab engine ?

Post by kiyarash »

thanks for the reply with a friend's help I managed to solve the problem.

1. as you stated above the addresses used in OV should use '/' instead of '\' which is the default way of separating an address in windows (I really don't get the reason behind that; because it can potentially cause a lot of unnecessary problems and editing when copy pasting an address ! ) this was actually my problem when I was trying to read a prerecorded session .

2. the default address for the "matlab executable" property when you first drag and drop the box in a scenario is "{matlab-directory}/R2011b/bin/matlab.exe" while what you should really write is "{matlab-directory}/R2011a/bin/win32/MATLAB.exe" .

meaning there are two matlab.exe in the bin folder first one directly inside the bin folder and the second one in the win32 subfolder. you must use the second one!

besides the tutorial on how to fill this property says
Path to Matlab executables (Windows) / Matlab launch command (Linux): tells OpenViBE how to execute the Matlab engine. Set it to the directory where is matlab.exe on Windows or type the command you use to launch Matlab on Linux.
which does not exactly help only in the examples (if you are a keen observer) you can see that it is also using the exe in the win32 subfolder.

brodwix1
Posts: 3
Joined: Tue Jun 19, 2018 4:34 am

Re: can not connect the matlab box to matlab engine ?

Post by brodwix1 »

I had the same problem.

I'm using Matlab 2015 32 bits and a 64 bit version, Windows 10 64 bits and OpenVibe 1.3

I solved it reading this link

now the tutorial works! :lol: :lol: :lol:

https://www.mathworks.com/matlabcentral ... -installed

jtlindgren
Posts: 775
Joined: Tue Dec 04, 2012 3:53 pm
Location: INRIA Rennes, FRANCE

Re: can not connect the matlab box to matlab engine ?

Post by jtlindgren »

Hello Brodwix1 & Kiyarash,

thanks for the tips! It may be that Mathworks is changing the path to the appropriate .exe from version to another, so the path we put into the box per default can be incorrect for anything except the exact version stated there.

The reason why Openvibe doesn't like \ is that the original authors of the software preferred unix style paths and reserved \ to be an escape character. If we wanted to change that, we'd need to put some serious work into it, at this point. Of course the glory really belongs to Microsoft who after all could have used the / in their MS-DOS like those people on Unix did at the time. But no, they had to choose \ ... AND put spaces in folder names. ;)


Best,
Jussi

Post Reply