I’m trying to solve an optimization program but have all the matrices as matlab files. I was able to import those that have numbers within the matrix but those with variables give the following error:
BoundsError: attempt to access 15-element Array{Type,1} at index [17]
in read at MAT\src\MAT_v5.jl:352
in read_matrix at MAT\src\MAT_v5.jl:302
in read_matrix at MAT\src\MAT_v5.jl:331
The code used is the following:
file = matopen(“x.mat”)
FA = read(file, “x”)
close(file)
Does anyone know how to address this issue?
Thank you
That error usually means there’s some values in the mat file that’s not supported (at least that’s what I got in this case and from a rough reading of the code I can imagine it happen for other unsupported objects too).
I fixed the issue by just not saving that object in the mat file. (It was put in there by someone else a long time ago and we don’t actually need it anyway…) You can check all the fields in the mat file to verify if this is an issue for you.
1 Like
Turns out there were some spaces and brackets in the matrix. Thank you
I am just starting to learn Julia and trying to run the following code, adapted from above:
using MAT
fileIn = matopen(“complexDomainData.mat”)
dset = read(fileIn)
close(fileIn)
but I get the error:
LoadError: File “complexDomainData.mat” does not exist and create was not specified
The file was created in Matlab and opens OK in Matlab. I can also import it into R.
Any help appreciated
Yes, the file was created in Matlab and opens OK in Matlab. I can also import it into R. It just contains some numeric arrays.
Either:
(1) Go to the folder where the file is (cd("ToWhereTheFileIs)
) and then try again to read it, or
(2) Supply the full path/filename to matopen
2 Likes
Many thanks, the full path solved the problem.