# Load matlab files in pytorch

**URL:** <https://discuss.pytorch.org/t/load-matlab-files-in-pytorch/138165>\
**Category:** Uncategorized\
**Created:** [November 30, 2021, 5:55pm UTC](https://discuss.pytorch.org/t/load-matlab-files-in-pytorch/138165 "2021-11-30T17:55:18Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![eqy](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/eqy/32/46233_2.png) [@eqy](https://discuss.pytorch.org/u/eqy)\
**Post date:** [November 30, 2021, 7:52pm UTC](https://discuss.pytorch.org/t/load-matlab-files-in-pytorch/138165/2 "2021-11-30T19:52:23Z")

</div>

I believe this method might work here:

> [@How to convert .mat file struct into pytorch Tensors](https://discuss.pytorch.org/t/how-to-convert-mat-file-struct-into-pytorch-tensors/38094/2):
>
> I guess you’ve opened the file using scipy.io? If so, you should get a dict with all the members and can just load these arrays as numpy arrays. Once you have the numpy data, you can transform them to torch.Tensors using torch.from\_numpy(). Have a look at some examples from the [scipy docs](https://docs.scipy.org/doc/scipy/reference/tutorial/io.html) on how to load the data.

---

_[View the full topic](https://discuss.pytorch.org/t/load-matlab-files-in-pytorch/138165)._
