Python常用功能汇总
来源:互联网 发布:fifaonline3数据库更新 编辑:程序博客网 时间:2024/05/18 01:38
1. Python数据和matlab数据转换
1.1 Python加载和写入.mat文件
File IO (scipy.io)
See alsonumpy-reference.routines.io (in numpy)
MATLAB files
*loadmat(file_name[, mdict, appendmat])* Load MATLAB file*savemat(file_name, mdict[, appendmat, ...])* Save a dictionary of names and arrays into a MATLAB-style .mat file.*whosmat(file_name[, appendmat])* List variables inside a MATLAB file
How to do
import scipy.io as siomat_contents = sio.loadmat('octave_a.mat')mat_contents>>>{'a': array([[[ 1., 4., 7., 10.], [ 2., 5., 8., 11.], [ 3., 6., 9., 12.]]]), '__version__': '1.0', '__header__': 'MATLAB 5.0 MAT-file, written by Octave 3.6.3, 2013-02-17 21:02:11 UTC', '__globals__': []}oct_a = mat_contents['a']oct_a>>>array([[[ 1., 4., 7., 10.], [ 2., 5., 8., 11.], [ 3., 6., 9., 12.]]])oct_a.shape>>>(1, 3, 4)sio.savemat('np_vector.mat', {'vect':vect})
If you want to inspect the contents of a MATLAB file without reading the data into memory, use the whosmat command:
sio.whosmat('octave_a.mat')>>>[('a', (1, 3, 4), 'double')]
对于高版本的.mat数据读写,需要使用另外的接口
import h5pydatasets = F:/MuraDefectData_6X6_10W_NonZCA_Batches.mat'f = h5py.File(datasets, 'r')TotalBatchImg = f['TotalBatchImg']TotalBatchImg = np.array(TotalBatchImg)wSize = f['wSize']wSize = np.array(wSize)
1.2 Python和matlab数据读写关系
—–未完待续
2.python参数解析argsparse
http://blog.xiayf.cn/2013/03/30/argparse/
http://blog.ixxoo.me/argparse.html
http://python.usyiyi.cn/python_278/library/argparse.html
http://yongli1992.com/?p=72
3.关于Python的线程问题
3个实例帮你理解Python中的线程
个人觉得讲的非常好~~赞一个
0 0
- Python常用功能汇总
- Android常用功能汇总
- MFC 常用功能汇总
- IDL常用功能汇总
- js常用功能汇总
- oracle 常用功能函数汇总
- oracle 常用功能函数汇总********************
- oracle 常用功能函数汇总
- 常用JS功能函数汇总
- Python 3.0 常用功能
- Python常用功能函数
- python常用功能总结
- python常用模块、框架汇总
- Python常用常见知识汇总
- python 字符串常用操作汇总
- Python常用学习库汇总
- 自建首部曲常用参数功能汇总
- Oracle 最常用功能函数经典汇总
- 文章标题
- Word Break II
- JSP中超链接跳转时的中文错误问题
- 火云开发课堂 - 《Shader从入门到精通》系列 第二节:在Shader中通过参数设置颜色
- oracle的导入导出imp/exp
- Python常用功能汇总
- 自定义UITableViewCell重用cell
- iOS开发-Xcode7模拟器会黑屏处理方法
- 关于myeclipse的破解run.bat一闪而过的问题
- IOS 6.0+ Autolayout — UITableViewCell 高度调整
- [优化篇]OpenStack的虚拟桌面协议Spice代替VNC(1)
- Putty使用设置
- 清理Xcode缓存
- 软件测试之黑盒测试