# Importing a leadfield matrix from a .mat file

**URL:** <https://mne.discourse.group/t/importing-a-leadfield-matrix-from-a-mat-file/4677>\
**Category:** Support & Discussions\
**Tags:** ﻿source-localization, data-import\
**Created:** [April 8, 2022, 10:05am UTC](https://mne.discourse.group/t/importing-a-leadfield-matrix-from-a-mat-file/4677 "2022-04-08T10:05:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![zahransa](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/zahransa/32/220_2.png) [@zahransa](https://mne.discourse.group/u/zahransa)\
**Post date:** [April 8, 2022, 10:05am UTC](https://mne.discourse.group/t/importing-a-leadfield-matrix-from-a-mat-file/4677/1 "2022-04-08T10:05:26Z")

</div>

mne.io.RawArray can do it for raw data,  
We see also the forward model as a .fif file,  
What about if we have a lead field matrix in .mat file and we need to convert it to .fif file?  
Thank you in advance!

---

<div class="post-metadata">

**Author:** ![richard](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/richard/32/15_2.png) [@richard](https://mne.discourse.group/u/richard)\
**Post date:** [April 8, 2022, 10:20am UTC](https://mne.discourse.group/t/importing-a-leadfield-matrix-from-a-mat-file/4677/2 "2022-04-08T10:20:11Z")

</div>

Hello @zahransa and welcome to the forum!

I have moved your message to a new topic, as he one you posted it to was already resolved and covered a slightly different question.

As for your actual question: It depends on how the .mat file is organized. One can store basically arbitrary information in a .mat file, and you’ll have to figure out the structure to extract the leadfield matrix correctly. I suppose no-one will be able to really help unless you share the data or at least describe how it was produced.

Best wishes,

Richard
