Importarea fișierelor MATLAB

Introducere în importul datelor în Python

Hugo Bowne-Anderson

Data Scientist at DataCamp

MATLAB

  • „Matrix Laboratory"
  • Standard în inginerie și știință
  • Date salvate ca fișiere .mat

ch_2_4.005.png

Introducere în importul datelor în Python

SciPy vine în ajutor!

  • scipy.io.loadmat() - citire fișiere .mat
  • scipy.io.savemat() - scriere fișiere .mat
Introducere în importul datelor în Python

Ce este un fișier .mat?

ch_2_4.010.png

Introducere în importul datelor în Python

Ce este un fișier .mat?

ch_2_4.011.png

Introducere în importul datelor în Python

Importarea unui fișier .mat

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

print(type(mat))
<class 'dict'>
  • keys = nume de variabile MATLAB
  • values = obiecte atribuite variabilelor
print(type(mat['x']))
<class 'numpy.ndarray'>
Introducere în importul datelor în Python

Să exersăm!

Introducere în importul datelor în Python

Preparing Video For Download...