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 strings not supported #150

Open
MaxandreJ opened this issue Nov 18, 2018 · 0 comments
Open

Matlab strings not supported #150

MaxandreJ opened this issue Nov 18, 2018 · 0 comments

Comments

@MaxandreJ
Copy link

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

@MaxandreJ MaxandreJ changed the title Strings not supported Matlab strings not supported Nov 18, 2018
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