Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MATLAB.MEngineError("failed to put variable A into MATLAB session (err = 1)") #225

Open
dhtantoy opened this issue Apr 3, 2024 · 0 comments

Comments

@dhtantoy
Copy link

dhtantoy commented Apr 3, 2024

I met an issue when I relegated the program to the background using nohup.

ERROR: LoadError: MATLAB.MEngineError("failed to put variable A into MATLAB session (err = 1)")
Stacktrace:
  [1] put_variable(session::MATLAB.MSession, name::Symbol, v::MATLAB.MxArray)
    @ MATLAB ~/.julia/packages/MATLAB/xBhSu/src/engine.jl:153
  [2] put_variable
    @ ~/.julia/packages/MATLAB/xBhSu/src/engine.jl:157 [inlined]
  [3] ......

I need to frequently input a matrix A and vector b into the MATLAB session for resolution. The code is like

function (solver::MatlabSolver)(A, b)
    # `solver` has a field `s` which is an MSession
    put_variable(solver.s, :A, A)
    put_variable(solver.s, :b, b)
    eval_string(solver.s, "u = A \\ b;")
    uh = get_mvariable(solver.s, :u) |> jvector
    return uh
end

Everything began smoothly, but when I relegated the program to the background, the aforementioned issue would manifest after approximately several dozen iterations.
Matlab version:

MATLAB Version: 9.11.0.1809720 (R2021b) Update 1
MATLAB License Number: xxx
Operating System: Linux 5.14.0-70.26.1.el9_0.x86_64 #1 SMP PREEMPT Tue Sep 20 17:53:31 UTC 2022 x86_64
Java Version: Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode

julia version:

julia version 1.10.2

MATLAB.jl version:

[10e44e05] MATLAB v0.8.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant