JuliaInterop / JuliaInterop/MATLAB.jl

Error when importing empty cell array

Open
#149 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
286
Forks
64
PR merge metrics
No merged PRs in 30d

Description

Hi,

See first answer below, I have provided a minimal working example now. The problem is with a cell array of any size containing uninitialised values.

On Julia 1.0.2 and MATLAB.jl v"0.7.0", with a 4x4 cell array MATLAB variable containing 1200001 x 1 double (4 of them, on the first row) and [] (on the other rows),

I run

file = read_matfile(filepath)
my_variable_MxArray = file[variable_name]
my_variable_julia = jvalue(my_variable_MxArray)

and get the error

ERROR: NULL pointer for MxArray.

with the stacktrace

Stacktrace:
 [1] Type at /Users/maxandrejacqueline/.julia/packages/MATLAB/ZuG4g/src/mxarray.jl:8 [inlined]
 [2] get_cell at /Users/maxandrejacqueline/.julia/packages/MATLAB/ZuG4g/src/mxarray.jl:359 [inlined]
 [3] _jarrayx(::String, ::MATLAB.MxArray, ::Tuple{Int64,Int64}) at /Users/maxandrejacqueline/.julia/packages/MATLAB/ZuG4g/src/mxarray.jl:506
 [4] jmatrix(::MATLAB.MxArray) at /Users/maxandrejacqueline/.julia/packages/MATLAB/ZuG4g/src/mxarray.jl:521
 [5] jvalue(::MATLAB.MxArray) at /Users/maxandrejacqueline/.julia/packages/MATLAB/ZuG4g/src/mxarray.jl:605

I do not have time to provide a minimal working example (MWE) at the moment. I have provided an MWE now.

Best,
Max

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the minimal working example in the issue and trace the stacktrace through src/mxarray.jl, especially get_cell, _jarrayx, jmatrix, and jvalue around the referenced lines. Reproduce the import of a cell array containing uninitialised values, then inspect how those cells are converted. Done means the example no longer raises the NULL pointer error and existing conversion behavior remains intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia, matlab
Domain
data, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.