JuliaInterop / JuliaInterop/MATLAB.jl
Matlab strings not supported
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 286
- Forks
- 64
- PR merge metrics
- No merged PRs in 30d
Description
Hi all,
This is similar to #135 but extends the issue to simple strings (1x1 string array). It wasn't obvious to me that a string behaved like a string array so maybe this should be clarified in the README.
A simple 1x1 string (which is a particular case of string array), defined and saved as such
my_test = "test";
save("../../../Data/test/test.mat",'my_test')
when imported into Julia using
my_matfile_contents = read_matfile("../../Data/test/test.mat")
my_variable_MxArray = my_matfile_contents["my_test"]
my_variable_julia = jvalue(my_variable_MxArray)
returns
ERROR: ArgumentError: Unsupported kind of variable.
Stacktrace:
[1] jvalue(::MxArray) at /Users/maxandrejacqueline/.julia/packages/MATLAB/ZuG4g/src/mxarray.jl:610
[2] top-level scope at none:0
and when the string is inside a struct, as such
my_test = struct;
my_test.test = "test";
save("../../../Data/test/test.mat",'my_test')
running
my_matfile_contents = read_matfile("../../Data/test/test.mat")
my_struct_MxArray = my_matfile_contents["my_test"]
my_struct_julia = jvalue(my_struct_MxArray)
returns
ERROR: NULL pointer for MxArray.
Stacktrace:
[1] Type at /Users/maxandrejacqueline/.julia/packages/MATLAB/ZuG4g/src/mxarray.jl:8 [inlined]
[2] Dict(::MxArray) at /Users/maxandrejacqueline/.julia/packages/MATLAB/ZuG4g/src/mxarray.jl:587
[3] jvalue(::MxArray) at /Users/maxandrejacqueline/.julia/packages/MATLAB/ZuG4g/src/mxarray.jl:608
[4] top-level scope at none:0
Best,
Max
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
Start with the jvalue paths shown in src/mxarray.jl at lines 610, 608, and 587, and reproduce the examples using read_matfile for a standalone string and a struct field. Trace how these MATLAB string arrays are represented and confirm that both examples convert without the reported errors; check whether the README also needs clarification.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia, matlab
- Domain
- data
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100