MATLAB.jl icon indicating copy to clipboard operation
MATLAB.jl copied to clipboard

Failed to open a MATLAB engine session on Windows

Open wangjie212 opened this issue 5 years ago • 6 comments

Hello,

When calling MSession(), I get the following error on Windows: ERROR: MEngineError("Failed to open a MATLAB engine session") in MSession at MATLAB\cVrxc\src\engine.jl:23.

I'm using Matlab R2019b 64 bits. I can start Matlab normally. I have set the env variable MATLAB_HOME and runned matlab -regserver in a Command Prompt as Administrator.

Anyone knows how to fix this?

wangjie212 avatar Feb 05 '20 18:02 wangjie212

which julia version and platform?

musm avatar Feb 05 '20 20:02 musm

Julia 1.2.0 Windows10

wangjie212 avatar Feb 05 '20 20:02 wangjie212

Without explicitly calling MSession, can you just do

mat"ver"

to see if Julia will connect to the Matlab engine?

ronubi avatar Feb 07 '20 22:02 ronubi

Without explicitly calling MSession, can you just do

mat"ver"

to see if Julia will connect to the Matlab engine?

It reports the error: MEngineError("failed to open MATLAB engine session")

wangjie212 avatar Feb 10 '20 10:02 wangjie212

very odd.

musm avatar Feb 10 '20 20:02 musm

I had to do the following (which is manually/hardcoded for R2020b)

  1. clone my version https://github.com/jacob-roth/MATLAB.jl.git
  2. add push!(LOAD_PATH,"C:\\Users\\roth0674\\git\\MATLAB.jl") to AppData/Local/Programs/Julia-1.x.x/etc/julia/startup.jl and open REPL
  3. from REPL, set ENV["MATLAB_ROOT"] = "C:\Program Files\MATLAB\R2020b\" (you will have to move it to this location if you dont want to edit my fork)
  4. ] add "C:\path\to\cloned\MATLAB.jl"
  5. ] build MATLAB
  6. using MATLAB

jacob-roth avatar Oct 19 '23 22:10 jacob-roth