# Use of MRtrix3 in MATLAB

**URL:** <https://community.mrtrix.org/t/use-of-mrtrix3-in-matlab/6086>\
**Category:** Uncategorized\
**Created:** [October 3, 2022, 4:33pm UTC](https://community.mrtrix.org/t/use-of-mrtrix3-in-matlab/6086 "2022-10-03T16:33:20Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![jdtournier](https://community.mrtrix.org/user_avatar/community.mrtrix.org/jdtournier/32/2594_2.png) [@jdtournier](https://community.mrtrix.org/u/jdtournier)\
**Post date:** [October 4, 2022, 12:54pm UTC](https://community.mrtrix.org/t/use-of-mrtrix3-in-matlab/6086/2 "2022-10-04T12:54:05Z")

</div>

Hi James,

Running MRtrix commands from Matlab can be a bit of a headache – see [this old thread](https://community.mrtrix.org/t/possible-to-run-mrtrix-executables-from-matlab/430) outlining some of the issues.

In your case however, you’re trying to run this on a Windows system, presumably using the Windows-native version of Matlab to invoke the MSYS2 version of MRtrix executables. That’s going to be even trickier… There’s a [whole page on the MSYS2 wiki](https://www.msys2.org/wiki/Launchers/) on how to do it, if you really want to give it a shot. From what I can gather, something like:

```auto
system ('C:\msys64\usr\bin\env MSYSTEM=MINGW64 /usr/bin/bash -li mrview')

```

_might_ do the trick… (though you may need to edit the location of the `env` command for your system, depending on where you installed MSYS2).

Good luck,  
Donald.

---

_[View the full topic](https://community.mrtrix.org/t/use-of-mrtrix3-in-matlab/6086)._
