JuliaInterop / JuliaInterop/MATLAB.jl

mxarray on partially initialized structs

Open
#185 0 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

In one of the packages I use there is a struct that gets partially initialized. This makes it so mxarray fails because of :

mxarray.jl:488
set_field(mx, names_str[i], mxarray(getfield(d, names[i])))

getfield throws an error, as this field isn't defined. I'm not entirely sure how to go about fixing this. I guess you could add a new UNDEF struct in matlab.jl, check if isdefined(d,names[i]) and if not, do set_field(mx,names_str[i],mxarray(UNDEF)) (if this sounds ok I'll open a pull request).

Alternatively, I can define my own mxstruct conversions for those problematic types.

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 at mxarray.jl:488 and inspect how partially initialized struct fields are handled before getfield is called. Review matlab.jl for the proposed undefined-value representation; done means mxarray can convert such structs without failing while preserving the missing-field state.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.