JuliaInterop / JuliaInterop/MATLAB.jl
Error: The Matlab array must either be a cell array or a double precision matrix
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 286
- Forks
- 64
- PR merge metrics
- No merged PRs in 30d
Description
I have compiled lbfgsb on Linux for Matlab. and trying to run the example
with the translation of
using MATLAB
x0 = [-3 -1 -3 -1]; #% The starting point.
lb = [-10 -10 -10 -10]; ##% Lower bound on the variables.
ub = [+10 +10 +10 +10]; #% Upper bound on the variables.
mat """
$x = lbfgsb_mex($x0,$lb,$ub,'computeObjectiveHS038','computeGradientHS038',...
[],'genericcallback','maxiter',80,'m',4,'factr',1e-12,...
'pgtol',1e-5);"""
but got the error
Error using lbfgsb_mex
The Matlab array must either be a cell array or a double precision matrix
Error using save
Variable 'jx_lbfgsb_mex_arg_out_1' not found.
ERROR: MATLAB.MEngineError("failed to get variable jx_lbfgsb_mex_arg_out_1 from MATLAB session")
Stacktrace:
[1] get_mvariable(::MATLAB.MSession, ::Symbol) at /home/myname/.julia/v0.6/MATLAB/src/engine.jl:162
[2] mxcall(::MATLAB.MSession, ::Symbol, ::Int64, ::Array{Int64,1}, ::Vararg{Any,N} where N) at /home/myname/.julia/v0.6/MATLAB/src/engine.jl:291
[3] mxcall(::Symbol, ::Int64, ::Array{Int64,1}, ::Array{Int64,1}, ::Vararg{Any,N} where N) at /home/myname/.julia/v0.6/MATLAB/src/engine.jl:315
Can anyone shed light on this problem? Simple passing the arrays into matlab and get values out of it are working fine, the error occurs when I try to call the lbfgsb_mex. Note that the other calls i.e. svd, sum in MATLAB work fine.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure with src/examplehs038.m and the lbfgsb_mex call, then inspect MATLAB/src/engine.jl at lines 162, 291, and 315 alongside the reported stack trace. Trace how the lbfgsb_mex arguments and return value are transferred through the MATLAB engine; done means the example runs without the array-type or missing-variable errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia, matlab
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100