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

Trying to save variable throws: LoadError: This is the write function for CompositeKind, but the input doesn't fit #50

Closed
aramirezreyes opened this issue Jan 26, 2016 · 5 comments

Comments

@aramirezreyes
Copy link

Hi! Trying to save a variable to a .MAT file with julia 0.4.2 throws:

ERROR: LoadError: This is the write function for CompositeKind, but the input doesn't fit
 in m_write at /home/argel/.julia/v0.4/MAT/src/MAT_HDF5.jl:485
 in write at /home/argel/.julia/v0.4/MAT/src/MAT_HDF5.jl:494
 [inlined code] from /media/argel/ARR_ECAIM/2016/Cortes_horizontales_Presion_mod2.jl:97
 in anonymous at no file:0
 in include at ./boot.jl:261
 in include_from_node1 at ./loading.jl:304
 in process_options at ./client.jl:280
 in _start at ./client.jl:378
while loading /media/argel/ARR_ECAIM/2016/Cortes_horizontales_Presion_mod2.jl, in expression starting on line 8

The variable is defined by
Alturas = 2000: 100:5000

And im trying to save it as:
filep = matopen(string(Ruta2,"P_4D_n_",archi,".mat"),"w");
write(filep,"Alturas",Alturas);
close(filep);

I believe is a bug.

I wish i could be of more help!

@simonster
Copy link
Member

2000:100:5000 is a StepRange{Int,Int}, which is not a type supported by MATLAB. Use collect(Alturas) to convert it to a vector.

@aramirezreyes
Copy link
Author

Damn! Thanks a lot for the support! i should've noticed... Sorry!

@BambOoxX
Copy link

BambOoxX commented May 4, 2021

@simonster I just had the same issue. Of course, I stumbled upon this page, so the problem was solved quite easily, but do you think it could help users to have either a more explicit error message or (maybe too aggressive) an automatic conversion to vector of such range objects ?

@iuliancioarca
Copy link

I experienced something similar while saving a dict containing ascii char. Background: first saved a .mat file with a field containing the string "s". Somehow, when reading it back, it was read as ascii char 's'. Saving again on disk failed with the mentioned error.

@pitsianis
Copy link

In case anybody else runs into this, a Julia value of nothing also triggers this error. I replaced it with [] to go through.

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

5 participants