Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
read matlab data
#1
Photo 
Hello,
I have some data stored in a matab file (data.mat). The data is stored in a table as shown in the following figure (screen shot from matlab).
   
I use the following python code to read in the mat-file:
import scipy.io as spio
lib = spio.loadmat('data.mat')
lib
Output:
{'__header__': b'MATLAB 5.0 MAT-file, Platform: PCWIN64, Created on: Fri Oct 6 18:07:57 2023', '__version__': '1.0', '__globals__': [], 'None': MatlabOpaque([(b'data_test', b'MCOS', b'table', array([[3707764736], [ 2], [ 1], [ 1], [ 1], [ 2]], dtype=uint32)) ], dtype=[('s0', 'O'), ('s1', 'O'), ('s2', 'O'), ('arr', 'O')]), '__function_workspace__': array([[ 0, 1, 73, ..., 0, 0, 0]], dtype=uint8)}
data_1=lib['__function_workspace__'][0]
data_1
Output:
array([ 0, 1, 73, ..., 0, 0, 0], dtype=uint8)
len(data_1)
Output:
16056
When I read in the mat-file, I get a single vector, which makes no sense to me. Does anyone have an example of how to read in matlab files? I have attached table in the zip-file.

The mat-file is stored with Matlab version 9.7.0.1190202 (R2019b)

Attached Files

.zip   data.zip (Size: 38.14 KB / Downloads: 4)
Reply


Messages In This Thread
read matlab data - by pz16 - Oct-06-2023, 08:28 PM
RE: read matlab data - by snippsat - Oct-06-2023, 11:00 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
Smile How to further boost the data read write speed using pandas tjk9501 1 1,346 Nov-14-2022, 01:46 PM
Last Post: jefsummers
  Read json array data by pandas vipinct 0 2,014 Apr-13-2020, 02:24 PM
Last Post: vipinct
  Python read Excel cell data validation anantpatil 0 4,276 Jan-31-2020, 04:57 PM
Last Post: anantpatil
  Read data, recognize trends and send report vin0001 1 2,222 Oct-02-2019, 06:08 AM
Last Post: buran
  Read CSV data into Pandas DataSet From Variable? Oliver 7 14,306 Jul-05-2018, 03:29 AM
Last Post: answerquest
  Read Data with multiprocessing RomanRettich 1 2,540 Jun-16-2018, 02:33 AM
Last Post: woooee
  Saving data into .mat (Matlab Fiile) Tulo_Stone 0 2,455 Feb-28-2018, 12:57 AM
Last Post: Tulo_Stone
  Need help in framing data read from wav file Vishweshkumar 1 3,759 Feb-10-2017, 01:45 PM
Last Post: sparkz_alot

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020