pickle file in matlab
2013-09-17 17:15
696 查看
Load pickle files in Matlab
Posted on June 12, 2013 by xcorrhttp://xcorr.net/2013/06/12/load-pickle-files-in-matlab/
It’s easy enough to load .mat files in Python via the scipy.io.loadmat function. But what about loading .pickle files into Matlab? That’s easy enough by calling a system command in Matlab, like so:
function [a] = loadpickle(filename) if ~exist(filename,'file') error('%s is not a file',filename); end outname = [tempname() '.mat']; pyscript = ['import cPickle as pickle;import sys;import scipy.io;file=open("' filename '","r");dat=pickle.load(file);file.close();scipy.io.savemat("' outname '",dat)']; system(['LD_LIBRARY_PATH=/opt/intel/composer_xe_2013/mkl/lib/intel64:/opt/intel/composer_xe_2013/lib/intel64;python -c ''' pyscript '''']); a = load(outname); end
Note that I’m setting the LD_LIBRARY_PATH environment variable since Matlab seems to reset this variable internally and it causes .so module import errors in Python.
相关文章推荐
- 今天运行MATLAB,由于处理文件太多出现:Too many files open; check that FILES = 20 in your CONFIG.SYS file
- read .off file in matlab
- Save .mat file in older version matlab
- matlab运行中出现“Caught "std::exception" Exception message is: Message Catalog MATLAB:builtins was not loaded from the file."
- Parallel mex file in Matlab
- MATLAB报错“Exception in thread "FileDecorationCache request queue" java.lang.OutOfMemoryError: Java “
- Load pickle file(comes from python3) in python2
- how to change file names in matlab
- matlab:Warning: Unable to determine the number of frames in this file.
- When the nofile is set to unlimited in /etc/security/limits.conf file the user cannot login
- android The public type classname must be defined in its own file 报错
- Debug Assertion Failed file:afx.inl Line 177
- Two classes cannot be put in a .java file
- xxx is not in the sudoers file解决方法
- is not in sudoer file
- Android Studio 首坑 Gradle sync failed: Cause: error in opening zip file 的错误
- iOS 报错:cannot create weak reference in file using
- How to make a USB stick use ISO image file in debian
- is not in the sudoers file 解决
- 解决办法:matlab Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap