MAT.MAT_v5.Matlabv5File are not callable

julia> import MAT

julia> file = matopen(“/home/users/xdlan/myexperiment/VGG3D/rgbd-convnet-master/VGG3D/vgg-verydeep-16.mat”)
MAT.MAT_v5.Matlabv5File(IOStream(<file /home/users/xdlan/myexperiment/VGG3D/rgbd-convnet-master/VGG3D/vgg-verydeep-16.mat>), false, #undef)

julia> file
MAT.MAT_v5.Matlabv5File(IOStream(<file /home/users/xdlan/myexperiment/VGG3D/rgbd-convnet-master/VGG3D/vgg-verydeep-16.mat>), false, #undef)

julia> layers=file(“layers”)
ERROR: MethodError: objects of type MAT.MAT_v5.Matlabv5File are not callable
Stacktrace:
[1] top-level scope at none:0

这样得到的 file 应该是类似文件句柄吧。当然不能当函数调用。

这时候就应该看看官方文档 JuliaIO/MAT.jl

To read all variables from a MAT file as a Dict:

vars = matread("matfile.mat")

To get a list of variable names in a MAT file:

file = matopen("matfile.mat") 
varnames = names(file) 
close(file)

To check for the presence of a variable name in a MAT file:

file = matopen("matfile.mat") 
if exists(file, "variable") 
    # something 
end 
close(file)

yes thank you very much