# Create raw-object using mat-file

**URL:** <https://mne.discourse.group/t/create-raw-object-using-mat-file/8625>\
**Category:** Support & Discussions\
**Created:** [April 11, 2024, 1:48pm UTC](https://mne.discourse.group/t/create-raw-object-using-mat-file/8625 "2024-04-11T13:48:09Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![lily](https://avatars.discourse-cdn.com/v4/letter/l/97f17d/32.png) [@lily](https://mne.discourse.group/u/lily)\
**Post date:** [April 11, 2024, 1:48pm UTC](https://mne.discourse.group/t/create-raw-object-using-mat-file/8625/1 "2024-04-11T13:48:09Z")

</div>

**❓ If you have a question or issue with MNE-Python, please include the following info:**

- MNE version: 1.6.1
- operating system: Windows 10

Hi, I’m new to BCI and currently I’m dealing with a motor imagery task. Unfortunatly the data set is a mat-file. The structure has 3 fields: ‘signal’, ‘timeVector’ and ‘labels’. I already created the info and I know the labels. I tried following some mne tutorials but I have a huge problem dealing with the data format. Can anybody help me?

Best regards. 🙃

---

<div class="post-metadata">

**Author:** ![scott-huberty](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/scott-huberty/32/2715_2.png) [@scott-huberty](https://mne.discourse.group/u/scott-huberty)\
**Post date:** [April 11, 2024, 3:57pm UTC](https://mne.discourse.group/t/create-raw-object-using-mat-file/8625/2 "2024-04-11T15:57:27Z")

</div>

Hello @lily, can you you try reading the mat file into Python using [pymatreader](https://pymatreader.readthedocs.io/en/latest/) ?

---

<div class="post-metadata">

**Author:** ![scott-huberty](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/scott-huberty/32/2715_2.png) [@scott-huberty](https://mne.discourse.group/u/scott-huberty)\
**Post date:** [April 11, 2024, 11:13pm UTC](https://mne.discourse.group/t/create-raw-object-using-mat-file/8625/4 "2024-04-11T23:13:21Z")

</div>

Ok Awesome:

1. For the `Signal` you refer to of shape `(501760, 26)`, I assume  
this is `(n_samples, n_channels)`. Does that sound right to you?
2. Have you looked at [this tutorial](https://mne.tools/dev/auto_tutorials/simulation/10_array_objs.html#)? Specifically, you’ll need to pass your data into the [RawArray](https://mne.tools/dev/generated/mne.io.RawArray.html#mne.io.RawArray) constructor. `RawArray` expects the data shape to be `(n_channels, n_samples)`, so If my assumption about #1 is right, then you need to do something like `my_signal_array.T` first.

---

<div class="post-metadata">

**Author:** ![lily](https://avatars.discourse-cdn.com/v4/letter/l/97f17d/32.png) [@lily](https://mne.discourse.group/u/lily)\
**Post date:** [April 12, 2024, 11:10am UTC](https://mne.discourse.group/t/create-raw-object-using-mat-file/8625/5 "2024-04-12T11:10:41Z")

</div>

Yes that works. “Creating RawArray with float64 data, n\_channels=26, n\_times=501760  
Range : 0 … 501759 = 0.000 … 1959.996 secs” . But my raw.plot() is blank. ☹

---

<div class="post-metadata">

**Author:** ![scott-huberty](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/scott-huberty/32/2715_2.png) [@scott-huberty](https://mne.discourse.group/u/scott-huberty)\
**Post date:** [April 14, 2024, 6:45am UTC](https://mne.discourse.group/t/create-raw-object-using-mat-file/8625/6 "2024-04-14T06:45:00Z")

</div>

Can you try `raw.plot(scalings="auto")`?
