@@ -41,11 +41,11 @@ export MatlabStructArray, MatlabClassObject, MatlabOpaque, MatlabTable
4141
4242# Open a MATLAB file
4343const HDF5_HEADER = UInt8[0x89 , 0x48 , 0x44 , 0x46 , 0x0d , 0x0a , 0x1a , 0x0a ]
44- function matopen (filename:: AbstractString , rd:: Bool , wr:: Bool , cr:: Bool , tr:: Bool , ff:: Bool , compress:: Bool ; table:: Type = MatlabTable)
44+ function matopen (filename:: AbstractString , rd:: Bool , wr:: Bool , cr:: Bool , tr:: Bool , ff:: Bool , compress:: Bool ; table:: Type = MatlabTable, convert_opaque :: Bool = true )
4545 # When creating new files, create as HDF5 by default
4646 fs = filesize (filename)
4747 if cr && (tr || fs == 0 )
48- return MAT_HDF5. matopen (filename, rd, wr, cr, tr, ff, compress, Base. ENDIAN_BOM == 0x04030201 ; table= table)
48+ return MAT_HDF5. matopen (filename, rd, wr, cr, tr, ff, compress, Base. ENDIAN_BOM == 0x04030201 ; table= table, convert_opaque = convert_opaque )
4949 elseif fs == 0
5050 error (" File \" $filename \" does not exist and create was not specified" )
5151 end
@@ -73,26 +73,26 @@ function matopen(filename::AbstractString, rd::Bool, wr::Bool, cr::Bool, tr::Boo
7373 if wr || cr || tr || ff
7474 error (" creating or appending to MATLAB v5 files is not supported" )
7575 end
76- return MAT_v5. matopen (rawfid, endian_indicator; table= table)
76+ return MAT_v5. matopen (rawfid, endian_indicator; table= table, convert_opaque = convert_opaque )
7777 end
7878
7979 # Check for HDF5 file
8080 for offset = 512 : 512 : fs- 8
8181 seek (rawfid, offset)
8282 if read! (rawfid, Vector {UInt8} (undef, 8 )) == HDF5_HEADER
8383 close (rawfid)
84- return MAT_HDF5. matopen (filename, rd, wr, cr, tr, ff, compress, endian_indicator == 0x494D ; table= table)
84+ return MAT_HDF5. matopen (filename, rd, wr, cr, tr, ff, compress, endian_indicator == 0x494D ; table= table, convert_opaque = convert_opaque )
8585 end
8686 end
8787
8888 close (rawfid)
8989 error (" \" $filename \" is not a MAT file" )
9090end
9191
92- function matopen (fname:: AbstractString , mode:: AbstractString ; compress:: Bool = false , table :: Type = MatlabTable )
93- mode == " r" ? matopen (fname, true , false , false , false , false , false ; table = table ) :
94- mode == " r+" ? matopen (fname, true , true , false , false , false , compress; table = table ) :
95- mode == " w" ? matopen (fname, false , true , true , true , false , compress; table = table ) :
92+ function matopen (fname:: AbstractString , mode:: AbstractString ; compress:: Bool = false , kwargs ... )
93+ mode == " r" ? matopen (fname, true , false , false , false , false , false ; kwargs ... ) :
94+ mode == " r+" ? matopen (fname, true , true , false , false , false , compress; kwargs ... ) :
95+ mode == " w" ? matopen (fname, false , true , true , true , false , compress; kwargs ... ) :
9696 # mode == "w+" ? matopen(fname, true , true , true , true , false, compress) :
9797 # mode == "a" ? matopen(fname, false, true , true , false, true, compress) :
9898 # mode == "a+" ? matopen(fname, true , true , true , false, true, compress) :
@@ -185,8 +185,8 @@ vars["s"]["testTable"]
185185 3 │ 3489.0 Smith 2016-12-22T00:00:00 Fair Late, but only by half an hour. …
186186```
187187"""
188- function matread (filename:: AbstractString ; table:: Type = MatlabTable)
189- file = matopen (filename; table= table)
188+ function matread (filename:: AbstractString ; table:: Type = MatlabTable, convert_opaque :: Bool = true )
189+ file = matopen (filename; table= table, convert_opaque = convert_opaque )
190190 local vars
191191 try
192192 vars = read (file)
0 commit comments