matlab load pkl

function [a] = loadpickle(filename)
  if ~exist(filename,'file')
    error('%s is not a file',filename);
  end
  outname = [tempname() '.mat'];
  pyscript = ['import pickle;import sys;import scipy.io;file=open("' filename '", "rb");dat=pickle.load(file);file.close();scipy.io.savemat("' outname '.dat")'];
system(['python -c "' pyscript '"']);
a = load(outname);
end
 

 

特别不鲁棒的解决方案,不建议使用

©️2020 CSDN 皮肤主题: 技术黑板 设计师:CSDN官方博客 返回首页