MATLAB 파일 가져오기

Python에서 데이터 가져오기 입문

Hugo Bowne-Anderson

Data Scientist at DataCamp

MATLAB

  • “Matrix Laboratory”
  • 공학·과학 분야 표준
  • 데이터는 .mat 파일로 저장

ch_2_4.005.png

Python에서 데이터 가져오기 입문

SciPy로 해결!

  • scipy.io.loadmat() - .mat 파일 읽기
  • scipy.io.savemat() - .mat 파일 쓰기
Python에서 데이터 가져오기 입문

.mat 파일이란?

ch_2_4.010.png

Python에서 데이터 가져오기 입문

.mat 파일이란?

ch_2_4.011.png

Python에서 데이터 가져오기 입문

.mat 파일 가져오기

import scipy.io
filename = 'workspace.mat'
mat = scipy.io.loadmat(filename)

print(type(mat))
<class 'dict'>
  • keys = MATLAB 변수 이름
  • values = 변수에 할당된 객체
print(type(mat['x']))
<class 'numpy.ndarray'>
Python에서 데이터 가져오기 입문

연습해 봅시다!

Python에서 데이터 가져오기 입문

Preparing Video For Download...