python读取 .mat 文件(matlab文件) 您所在的位置:网站首页 mat文件如何打开 python读取 .mat 文件(matlab文件)

python读取 .mat 文件(matlab文件)

#python读取 .mat 文件(matlab文件)| 来源: 网络整理| 查看: 265

python读取 .mat 文件(matlab文件)和 scipy库包的使用(4—20181224) 一、python调勇scipy库读取.mat文件1、使用例子12、 使用例子2 二、scipy库包的使用

一、python调勇scipy库读取.mat文件

.mat文件:是matlab的文件,如果直接打开,一般看到的就是乱码的,此时可以借用scipy库进行读取该文件 scipy的一些基本使用,见下文

1、使用例子1 import scipy.io as scio path = r'E:\[EG_code_data]_release\data\images_tracker\00047.mat' reftracker = scio.loadmat(path)['tracker'] print(reftracker) 2、 使用例子2 import scipy.io as scio path = r'E:\workCode\2_DSPR\x2_d\test_01_d_01.mat' matdata = scio.loadmat(path) print(matdata)

从下面的输出结果可以看出,.mat 保存的是一个字典类型的数据,所以可以通过键 访问对应的键值 在这里插入图片描述

通过kernel 键访问键值,从上面可以看到 kernel中对应的键值是一个二维数组:

import scipy.io as scio path = r'E:\workCode\2_DSPR\x2_d\test_01_d_01.mat' matdata = scio.loadmat(path)['kernel'] print(matdata)

在这里插入图片描述

二、scipy库包的使用

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述 ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

      专题文章
        CopyRight 2018-2019 实验室设备网 版权所有