본문 바로가기
언어/ㄴPython

[python] How to get matlab data file '.mat' in python

by 공대우냉이 2016. 1. 25.


matlab_data.mat

load_mat.py


우선 matlab 에서 .mat 데이터를 생성해보자.

Frstly, we generate matlab data format file '.mat' in matlab

 

두번째로 python에서 이 데이터를 받는다.

이때, scipy.io 함수를 이용하여 .mat 파일을 받을 수 있다.

Secondly, we get this data in python. At the point, we use 'scipy.io' library in python.

 

위의 코드를 실행하면 .mat data를 받아서 train_set_x 에 해당하는 data를 print하게 된다.

train_set_x 데이터는 (3,10)행렬로 이뤄진 랜덤수 행렬이다.

If thee top code implement in python, we get .mat data and print 'train_set_x' data.

'train_set_x' data compose of 3 by 10 array of random number.

 

=======================================================================================================================================================

Reference

http://docs.scipy.org/doc/scipy/reference/tutorial/io.html

'언어 > ㄴPython' 카테고리의 다른 글

[python] randomly shuffle train data  (0) 2016.02.19
[python] python script is executed by matlabprogram  (0) 2016.02.04
[pyton] numpy.cmd  (0) 2016.01.21
[python] generating random array  (0) 2016.01.21
[python] what is assert  (0) 2016.01.21