File Exchange

image thumbnail

MATLAB File Association & Shortcut Fix

version 2.12 (14.1 KB) by Patrik Forssén
Fixes trouble with MATLAB file associations and missing shortcuts in Windows


Updated 19 Mar 2021

View Version History

View License

Editor's Note: Popular File 2018 2019 2020

This file was selected as MATLAB Central Pick of the Week

Writes a Windows registry file that fixes problems with MATLAB file associations in Windows, e.g., that m-files doesn't open up in MATLAB or opens up in a new instance. Can also be used to switch file associations between different installed versions of MATLAB. Detailed help is included in the file. Has been tested on Windows 7 for MATLAB R2012a and R2015a and on Windows 10 for MATLAB R2020a.

Also included is a program to add missing MATLAB shortcuts to the Windows desktop and start menu and a small Windows batch file to start MATLAB (for example if the installer fails to add shortcuts). Have been tested on Windows 10 for MATLAB R2020a.

Cite As

Patrik Forssén (2021). MATLAB File Association & Shortcut Fix (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (552)

Azat Gainutdinov

Christopher Struck

Merci beaucoup Patrik! C'etait super! - My blood pressure just went down to normal again after running this app! Worked perfectly in Win 10.

Moritz Stelter

Worked for Windows 10 / Matlab R2021a

Yeamim Hossain

Thomas Delaite

Md. Faisal Khan

How to do it, Steps:
1.Download the file.
2. Extract it.
3. Run the associateFiles.m file using MATLAB.
4. Then you'll get a MatlabFileAssocFix.reg
5. Run the MatlabFileAssocFix.reg file & press yes.
6. Run matlabshortcuts.bat file
7. Run runmatlab.bat file>
Done, now your file association problem should be fixed.

Patrik Forssén

@John Green
Thank you for detecting the bug. A new, corrected version has been uploaded.

John Green

crashes for me on 3/18/2021 at line 539 with fileExtTmp undefined error. Does the preceding if statement needs an else clause? Maybe something like: else fileExtTmp = fileExt;

Patrik Forssén

@Anton Semechko
Thank you for detecting this bug. I have uploaded a new, corrected version.

Anton Semechko

Anton Semechko

Changing line 508 in associateFiles.m to :

if ~isempty(addExtList) && ~ismember(fileExt, addExtList(:, 1))

fixes the error

Mohammad Shokrani

thanks a lot!


Thank you! It works.

Panagiotis Zachos

Thank you! Worked as described

Yong Meng

Thank you very much!
It works very well for MATLAB R2020b

Florent Halgatte

Patrik Forssén

@Panida Kaewniam

The first parameter should be '-add' (not 'add'), i.e, use the following call:
associateFiles('-add',{'.m', '.mat', '.fig', '.p', '.mexw64', '.mlapp', '.mltbx', '.mldatx', '.req', '.mlappinstall', '.mlpkginstall', '.mdlp', '.slxp', '.mdl', '.slx', '.sltx', '.ssc', '.mn', '.mu', '.muphlp', '.xvc', '.xvz', '.sldd', '.slddc'});

Panida Kaewniam

It doesn't work for me. I have an error when execute the associate file in the command window.
I use
associateFiles('add',{'.m', '.mat', '.fig', '.p', '.mexw64', '.mlapp', '.mltbx', '.mldatx', '.req', '.mlappinstall', '.mlpkginstall', '.mdlp', '.slxp', '.mdl', '.slx', '.sltx', '.ssc', '.mn', '.mu', '.muphlp', '.xvc', '.xvz', '.sldd', '.slddc',['.' mexext]});

The error is
Error using associateFiles (line 180)
The action to perform must be a string '-add', '-delete' or '-deleteadd'!

What should I do?

Itoje John

It worked well for me with MATLAB2020a.

Kumara Raja Eedara

Worked for me on (Windows7 Operating system, 2019b Matlab version)
1) Run .m file in matlab, MatlabFileAssocFix.reg is created.
2) Open command window in Windows
3) Run "MatlabFileAssocFix.reg"
4) Restart MATLAB.
Now when try to open .slx file system automatically suggests MATLAB as an option.

alic rou

Thanks a lot.
Finally after a lot of struggle, I managed to associate .m files to Matlab using your code and then running the .reg generated file with your code.

Lukas Kasper

Yang Zheng

Park Jeongha

Thank you

Ahmed iqbal

It works great with MATLAB R2020b

Felix Chiu

it can work, and works very well.

Chang hsiung

Patrik Forssén

@James Rex
Support for .prj files (+ some additional toolbox specific files) added in version 2.1.

James Rex

I repeat request from Michael B to add support of .prj files.
These still open with R2017a after I installed R2020b, and the "Open With" tools for modifying file association in Windows 10 File Explorer do not work in this case.


Kuifeng Zhao

Hi, thanks for the code. It didn't work for me at the beginning. After running the files, my matlab cannot work normally. Error is "loadlibrary failed with error 87 the parameter is incorrect". I am using Win 10, and Matlab version is R2020a. Problem persists after restart.
Then I found the solution from here:

Patrik Forssén

@Seungchoun Choi
Strange... Try to run associateFiles('deleteadd'), import the created registry file, restart the computer and see if this fixes the problem.
If not start the registry editor (Windows start menu -> Run... -> regedit) and locate the folder "Computer\HKEY_CLASSES_ROOT\MATLAB.mlx<version>". The first key there should now have data "MATLAB Live Script" if the fix worked.

Seungchoun Choi

it seems like something is messed up when you updated the code last week. .mlx file shows as Matlab toolbox and .mtlbx file shows as Matlab app.

Chungha Lee

You literally saved me, thanks

Jiaqi Zhang

Hsu Yung-Cheng

I'm using R2020a. It's very good.

Michael B

Any chance you could add support to .prj files? I'm running version R2019b on Win10 and have recently been having association issues with this file type on my system.

Wai Phyo Maung

Ignacio Martinez

Lukas Kasper

Vijay KG

I'm using R2019b. It is generating the MatlabFileAssocFix.Reg file but unable to run it. Getting the error "Cannot import C:\......: Error accessing the registry.". Any help on this highly appreciated.

Mücahid Akbas

wh z

Add the following
'mlx' , 'MATLAB Live Script' , '-71' , ...
{'Open', 'uiopen(''%1'',1)'} , {'Run', 'run(''%1'')'} ; ...
to "fileExtCell" will fix the association for "*.mlx". Not sure whether '-71' is correct or not, just simply choose a number that different from others. It works for me with Matlab 2019b. There is no ico file for *.mlx by default, which need to be added to C:\Program Files\Polyspace\R2019b\bin\win64 and named as mlx.ico. I sample copy the one for *.m files. Don't forget to replace the version and the path with the installed one.

MIchele Stante

Rajani Metri

Hello Sir,
I am unable to Associate my matlab files with new MATLAB 2020a in MacOS Catalina. Is there any such Fix? or How to do that association? please let me know.
Thank You.

Yusuke Iwaki


Only a minor foible though, it does not support '.mexa64', or '.mexmaci64' . But it is not important, I think.

Wenjie Huang


Excellent! It works on my MATLAB2020a on Windows 7! Thanks!!!

Umair Mughal

It's not working for .mlapp extension. Here's the registry Entry:



@="MATLAB Application"

@="C:\\Program Files\\Polyspace\\R2020a\\bin\\win64\\mlapp.ico,0"



I don't know how to fix this but probably this entry is different than others that are working. The missing entries are:
1. Shell Open
2. Shell Open command
3. Shell Open ddeexec
4. Shell Open ddeexec application
5. Shell Open ddeexec topic
6. Also, in fileExts location, 'Open With List' for .mlapp is missing; and that's why when I double click file, no application list shows. While it pops up for other extensions.

Alessandro Pittari

Grigorii Tarasov

Diptangshu Paul

I solved the problem I was facing regarding the registry file. This file also fixed a problem with Write permission in a code that had to write fig to a gif file.
Note: The registry file gets created in the, 'matlab root folder' > 'subfolder that contains matlab.exe'. It is better not to run matlab.exe as an administrator.
Thanks a lot @Patrik Forssén

Diptangshu Paul

The registry file is not getting created in the same folder. Does it get created somewhere else or should there be some other reason for which the registry file is not getting created?

Leonel Steve Jatsa

I have installed two versions of matlab, i.e. 2013b and 2020a. But I have a problem, it is that the 2020a version manages to launch correctly, on the other hand that of 2020a does not manage to launch.
Please help me.

Sina Khoshabi Nobar

roki william

Abigail Borromeo

I don't know why mine is not working, it shows up with the error:

Unrecognized function or variable 'binFolder'.

Error in associateFiles (line 96)
binPath = fullfile(matlabroot, 'bin', binFolder);


Margot Sullivan

Thank you! This worked with Matlab 2020a.

Bahram Raeisi

Oh, sorry about that. It's working now. thanks

Matthew Marti

Nélio Dias

Thanks very much! That's works in Matlab 2018!

Christopher Wong

It works! I recommend using the 'deleteadd' option, in case you messed anything up already. Also, don't forget to restart explorer after running the registry, or just reboot your pc.

Thanks so much!!!

Shahar Grossbard

Camilo Manrique

Malek Alsamdi

Working perfect.
Thank you.

Grzegorz Maslak

Belal Hmedan

It's working so fine, thanks

Tim Litwin


1. run .mfile
2. run the created .reg file
3. restart matlab

Eun-Khwnag Lee

Ishtiaq Khan

Yang Yang

jiajun duan

J Scotto

Karoly Csurilla

Yee Hin Chong

Tried on Windows 10 19041.84 for 2019b. Everything's fixed! Thanks!

Yutong Xue

I tried it on my MAC for 2016b, but it did not work. Is there a solution for MAC?

Thank you!

Jagadish Pandian

Worded on Windows 10 and fixed .m files opening as separate instance. Run as admin and import the registry.

Niklas Nawrath

can you add the live-script data format?

Jeroen Delplanque

Pi Ting

Ahmed Alghamdi

Felix Outlaw


Great!!! Works perfectly on MATLAB 2019b win10.

Aadeel Akhtar

Tao Zhou

Usefull file exchange

Aviv Elzera

Great!!! Works perfect on MATLAB 2019b
Saved me much time, thank you :)

Sina Birecik

It worked with my MATLAB R2013a on Windows 10 x64.
When you run .m file in Matlab, it will create a registry file in the same folder with .m file.


Works like magic!

Marcelo Fernandes

Works perfectly on Matlab 2019b on windows7

Jacob Livni

Thank you!


Great, it solved my problem very well.

Marco Lo Cascio

Jedrzej Szczepaniak

Dimitrij Chudinzow

Wei-Lee Wu

This was easy to use and fixed my issue instantly!

Vasileios Pettas

Christos Makrides


Works perfectly on Matlab 2019b on windows10

Lorenzo Longo

Mohanad Al-Ibadi

Worked on Matlab 2019b. Thanks.


Works successfully with R2019b on Windows 10


Works with R2018a on windows 10.

Xin-Wei Huang

Tom R

Bryan Hijnekamp


Works with r2019a! Great! Thanks!


Works with r2019b! Great! Thanks!

Le Xuan Thang

Perfect!. Thank you so much. r2018a


WOW!! It's like a magic! Thanks!
Work perfectly with matlab 2019a!!

Works perfectly on Matlab R2017a!

Kyle Wright

This worked!
Just in case this might be useful for someone else: my network blocked the registry file from running on my non-admin account (and right-clicking the .reg file didn't yield a "Run as Admin" option), so I had to open a command prompt as admin and execute "Regedit MatlabFileAssocFix.reg" to update the registry files. That proved successful though.

Jorge Rojas


Alfredo Ceseña

Works perfectly with matlab 2018a on windows 10

gonzalo quezada

Ying Huang

Hossein Mapar

Jessica McKee

Davit Harutyunyan

grigory yashin

John Callahan

Maria Jose Luque

Many thanks, worked fine on Matlab 2019a on Windows 10.


It worked for me. I was having .m files openedd at Notepad and .mat files oppend at Microsoft Access ! Now both format files are being opened at Matlab, in a single instance. I use Matlab 2018a, Windows 10. Thank you for the developer.

Jiming Sheng

Alex Salmon

Carl De Vries

Jakob Hornung

worked perfectly (Win 10, R2019a), many thanks!

Tuong Nguyen

Struggled to set new version of Matlab as default program to open Matlab files and then found this thread. Very useful script!

Rehan Qasim

how to associate .mlx (live editor file)?

Michael Shiplyuk

fixed problem for my win10 2017b

Youn Kyung Song

I love you !!!! It fixed all the hassles of opening multiple instances at every double-clicking of .m files!!!!!

Sara Battaglioli

fixed my problem with 2018b

Karen Adler

Penning Yu

it works well for my 2019a.

Hongseok Jeong

Adam Danz

Fixed my problem with r2019a. Thanks for making that solution so simple!

Gennaro Principe


Works good. Tried on MATLAB 2018a with Windows 10. Solved annoying issue : clicking on .fig or .m or .mat file, a new Matlab instance was opened. After running function, close all Matlab instances, and click on generated Registration entries file, restart Matlab

pankaj singh

But it still opens the whole Matlab session, even if I just want to open the Matlab figure file. How to solve that?


It works like a charm!
Finally I can open files from folders without starting a new session of Matlab.

Yusuke Nakata

It worked for 2019a.

Viet Anh

Worked on Matlab 2016a. Thank you very much!


Sura Salih

Thanks a lot for your effort , it worked on 2018b version win 7 64 bit

Sixian Zhang

I uninstalled R2018b after installing 2019a on Windows 10, then it always opens up a new MATLAB instance when double-clicking on .m files.
This file fixed the problem perfectly!
Thank you so much!

Mathieu Walsh

Read the instructions and it will work perfectly.

Ekaterina Kazakova

Thank you so much! It helped for Windows 10, MATLAB R2019a

Xingwang Yong

It works, thank you very much!

Cristiana Traman

Thank you so much! (Windows 7 2017b)

Sebestény Dániel

thank you, it works perfectly!


Sam Deng

thank you very much!! this is very helpful!!

Dimitrij Chudinzow

Thank you very much! Great Work!

Chaitanya Awasthi

Worked like a charm!

This code solved the same problem. Thank you for your sharing.

Eduardo de la Rosa

It worked perfect!

Aya Tarek

Works on R2017b Windows 10
Thank you!

Anthony Shupenko

My problem is that m.files, .slx files etc. keep on defaulting to Adobe... so, tiles in this download shows as a PDF and does not work.

Mahdi Aziz

Thank you!


Work like magic!

Siyao Hu

Richa Dubey

Kuifeng Zhao

Alicia Buster

Matthew Bayer

Dustin Cook

Worked great for me for Matlab 2018b in Windows 10.
1) Run the Matlab File to create the registry file
2) Run the created registry file

ding dong

Guodong Cui



Simple, fast and perfect (Windows10, 2018b). Thanks!

Dustin Rhodes

Luca DI Stefano

It didn't work for me

Suleyman Serhani

doenst work

stich abdou

nesta3ref bik


Amritpal Sidhu

Fixed file association problem with windows 10 and R2018b


I was facing with defined problems in above. Simple to use and works perfectly!

Omid Khademhosseini


Kaixiang Wang

Worked like a charm. For people having errors showing that "Cannot write registry file". Restart MATLAB and run as administrator. Follow the instructions in the file and done!

Works Fine with R2018 Thanks

Andrea Bovino

perfect with R2018b. Spent hours to figure out how to associate, before finding this

DongYoung Kim

Worked perfectly with R2018b on Windows 10 Pro! Thanks!

Jake Johnson

Thumbs up! Woks perfectly for 2018a.

Borhan Hamedani

Works perfect. Do not forget to run your MATLAB as administrator

Shanaka Ramesh

can someone give me the steps. i use MATLAB 2018b with windows 10

Worked with Matlab R2017b.

Leone Campos

All right! (R2018a)

Maybe you can fix '.mlx' too! :D (file extension of Matlab Live Script)

Marvin Gildehaus

Worked perfectly with R2018b on Windows 10 Pro!

Lucas Moreira


sivan levi

worked great windows 10 matlab 2018b

Carolyn McClaskey

Thank you very much! Works great


Great! (2018a)

James Ratti

Failed to create registry file.

noy guzi



A. Villafranca

Galen Hoffman

This worked beautifully for 2018b. Thank you 8D

Andrew Riali

Worked perfectly for 2018b! Thanks!

Yurii Elkyn

Worked for 2017b. Thanks!!!

Samantha Irvin

Shokoofeh Parvin

Worked for 2018a Win10, many thanks!

Mohammed Khallaf

It worked very well on MATLAB 2018a win10.

Pierre Vogler-Finck

Adithya Naresh

I accidentally associated my .m files to Matlab.exe, which then started opening Matlab every time. This file helped fix that problem by updating the registry directly just by simply running the function and running the .reg file that is created. Thank you Patrik for making this!

guru prakash

saved my life.


work for MATLAB R2015a in Windows 10.

Thank you Mr! Hats off to you!

Arun Kashyap

Worked perfectly on MATLAB R2018a


Roman Luc

Luca Freilino

Ronald G A

It works for 2018b :) !!

Kian Kalan

doesn't work on 2018b

Ian Linsmeier

Jan Palecka

Aymen Dehmani

Max Vrany

Fei Jia

One of the best functions that I've used in matlab. Works for 2016a on win10.

Keith Hernandez

Wow. Thank you.
I had updated my Matlab version and the registry would not find 2018a version. This was done on a Windows 7 64bit. As soon as I ran the registryfix file everything worked again.
Again, Thank you

Yu Chou

Working on win 64bit Matlab 2017b. Thanks to you!

Flag Yan

Works on my win10 64bit + Matlab 2018, many thanks!


work just fine on windows 10 thank you !

Jacob Hensel

Nagabhushan SN

Thank you very much! Works like a charm with Matlab 2018a on Windows 7

Boris Benedikter

Thank you very much! It works for Matlab R2017a on Windows 10.

Peter Latta

Works for Matlab R2015b on Windows 10

Gustavo Fonseca

Doesn't work for R2017b for Windows 10.

lucas lenne

Works on Windows 10 for MATLAB R2017a

Works for 2018a on windows 7.

Chih-Ta Wu

Working on 2017b

Alexandru Tatomir

Khalil Sidawi

Christelle Zielinski

vishnu kavali

working on windows 10 MATLAB 2016a

Martina Raffellini

Rais Badshah

Thanks a lot! it works with MATLAb 2016a/win 10-64.

Eleni Vasilakou

Perfect! Works for Windows 10, Matlab R2018a. Thank you!

Yunhe Yu

Works! Win 7 Matlab2017b.
Thanks a lot!

Valeria di Battista

Henrique Furtado

Casey Heidrich

Working, Windows 10 R2018a Update 2

Mohamad Aramesh

Langchen Fan

Alex Salmon

Fauzan Adim

shoubhik karmakar

Enrico Spigarolo

Berat Dogan


Marco Capello

dasha negri

Yasheen Brijlal

heng ma

excellent and very convenient!


excellent work by the author - now please add live code MLX File (.mlx) files to your program

Guan-Wen Chen

Zhenbiao Zhou

Solved my problem! Thank you so much!!


It solves the problem. Thank you very much!

Vikaasa Kumar

Johannes Kalliauer

Is there a version for Linux? I have the problem "opens up in a new instance"

Alessandro Negri

Working for R2018a, thank you!

Thank you, worked perfectly on R2018a, Windows 10

Ian McLane


Why can this not be done through MatLab preferences... shame shame MathWorks.

Manuel Morales

Thank you!! this works perfectly


Worked perfectly for 2018a

Daniel Derrick

Daniel Derrick

Didn't work for me. 2018a.

Simon Brauer

Perfect! It works. Matlab R2018a on Windows 7.

francis chan

Raj N

Ou Weike

It works. Thanks.

Works! Don't forget to run Matlab as administrator, though.

pjman yucifee




Works. Matlab R2018a on 64-bit Windows 10

Eric Noordam

Thijs Boehme

Nirjhor Chakraborty

Worked perfectly on win10 with matlab 2017b

Zubiao Xiong

Junze Liu

Works for my R2018a on Windows 10 platform!!! Feel like the messy world has been saved!!! Thank you, MATLABman!

ewald strasser

made my day :-)

Rinse Liefferink

Works good!

Sina Hadipour

Thank you sooooo much, microsoft is really getting on my nerves with their forced updates that screw up everything. Thanks for the fix

Md Nazmul Azim Beg

Nice. It worked fine for Matlab 2018a in windows 10

Thanmay Sunil Menon

Works on 2018a...But doesn't associate .mlx

Stefan Dukic

Indeed, works for Matlab R2018a ... Brilliant!

Pierdomenico Schiano

Perfectly work also on Matlab R2018a

Polyzois Bountzis

Jason Randolph

I can't believe how bad Microsoft has messed up the Windows 10 interface for assigning default programs based on file extension. Utterly pathetic. I couldn't find any way to release .mat files from Access and remap to MATLAB no matter what I did.

Your tool provided the perfect fix. Thank you so much!

Elizabeth Agee


Do you have a version of this for Mac computers?

Mertcan Kaya


It works perfectly with Matlab R2017a!

Andrew Korolkov

Nan Luo

Austin Fite

Worked for me, thank you!

Works perfectly on MATLAB R2016a on windows 10, Thank you so much.

DS Chen

Works for 2015b

Daniel John

Fiddin Yusfida

It worked on Matlab 2017b

Felipe Contreras

Now I can't access any files from my computer in matlab. How do i fix that.

Florent Halgatte

Krzysztof Wascinski

works on Windows 10. Thank you !

Luca Amerio

Had a tricky situation with MATLAB installed on a shared drive for which I didn't have writing rights and each time I double clicked a matlab file it opened in a new instance.

This solved it as a charm! AMAZING!

MohammadReza Ebrahimi


Mayank Chetan

furkan isildak

Alp Sayin

James Connor

Roberta Mancini

Very nice program! Fixed my problem in 3 minutes :)


Yanis Bouhraoua

Eric Yuen

Worked perfectly, thank you!

Pavel Benes

Maziar Golestani

Kendall Hunter


André Larsen

zhongrui wang

Great job

Yingchun Li

worked for 2016b, good

Zhaochen He

wow it worked for 2017a


superb! working perfectly. Thanks a lot

L.A. Bras

Eoin Horgan


Thanks very much! It's necessary to run matlab as admin.And remember reboot,then okay!


Citizen Insane


Fatih Kendir

Thank you very much. It worked for 2016a.

Mohamed Karam-Allah

2017b working, thanks
same steps as said before
NOTE: Turn off anti-virus and UAC
1) Run Matlab as admin
2) put associateFiles.m in ....matlab folder ....mcr\toolbox\matlab\winfun\private
3)open and execute associateFiles.m
4) Execute the command (in matlab command window)
associateFiles('add',{'.m', '.mat', '.fig', '.p', '.mexw64', '.mlapp', '.mltbx', '.mldatx', '.req', '.mlappinstall', '.mlpkginstall', '.mdlp', '.slxp', '.mdl', '.slx', '.sltx', '.ssc', '.mn', '.mu', '.muphlp', '.xvc', '.xvz', '.sldd', '.slddc',['.' mexext]});
5) You will get regfile MatlabFileAssocFix.reg, run it

Mohamed Karam-Allah

2017b working, thanks
same steps as said before
1) Run Matlab as admin
2) put associateFiles.m in ....matlab folder ....mcr\toolbox\matlab\winfun\private
3)open and execute associateFiles.m
4) Execute the command (in matlab command window)
associateFiles('add',{'.m', '.mat', '.fig', '.p', '.mexw64', '.mlapp', '.mltbx', '.mldatx', '.req', '.mlappinstall', '.mlpkginstall', '.mdlp', '.slxp', '.mdl', '.slx', '.sltx', '.ssc', '.mn', '.mu', '.muphlp', '.xvc', '.xvz', '.sldd', '.slddc',['.' mexext]});
5) You will get regfile MatlabFileAssocFix.reg, run it

Brayan Torres Z.

This function works , but i would like to know more, in line 100, what does the variable 'fileExtCell' mean,
specially its columns 3-5, in order to add latest extensions. For example, I added one row more
{'mlx', 'MATLAB Live Script', [], [], []},
but files with this extension are not shown with the appropriate icon and can't be opened outside Matlab.

Joseph Huang

Works perfectly, thanks

Sietse Braakman

This works great. I also added ".sbproj" as an extra argument [ associateFiles('add','.sbproj') ] to allow Windows to automatically open SimBiology projects as well.

ahmed elkholy

Thanks a lot.It works.How do I associate .mlx file? Windows10+R2017b

Uri Burmester



2017b working!

David Lopes

Berg Bill

Thanks, this problem has troubled me since the version of 2014a, the registry file worked on 2017b!

ahmed almanea


Bui Tuan

It used to work until the Fall Creators Update i.e., Windows 10 ver 1709 build 16299.15, comes in and screwed everything up with their UWP default program association.
The current only way to work around this is that you HAVE to START MATLAB by opening a .m file. Only then all subsequent .m files will be opened in the same MATLAB instance.

I really hope that this script gets an update to fix this.

Hector Munoz

Wu Di Wu

Thanks a lot.It works.How do I associate .mlx file? Windows10+R2017b

Apostolos Athanasiou

Thanks a lot. It works perfectly! Windows 10 and matlab 2017b!!

Xu Shen

THANK YOU THANK YOU! This is a really great tool!!!!!!!! So GRATEFUL! (R2017a) It works well!

I upgraded from 2015b to 2017b today, and after the upgrade I couldn't dobule click open my m.-files. Downloading the script to my desktop and following the instructions of Muhammed Hafish solved the problem. Thanks!

Simone Rupp

Thank you thank you thank you! I tried all the official problem solving ideas provided by "MATLAB answers" but none worked, but this solution did! (Matlab 2017b + Win 7)
You saved my day...

Riccardo Felicetti

Good job! (Matlab 2017b + Win 8.1)

Muhammad Hafish

it works for R2016a, thank you
for those who still struggled with this problem, thanks to Yannis Gr, here what i did
1) Run Matlab as admin
2) Open and execute associateFiles.m
2) Execute the command (in matlab command window)
associateFiles('add',{'.m', '.mat', '.fig', '.p', '.mexw64', '.mlapp', '.mltbx', '.mldatx', '.req', '.mlappinstall', '.mlpkginstall', '.mdlp', '.slxp', '.mdl', '.slx', '.sltx', '.ssc', '.mn', '.mu', '.muphlp', '.xvc', '.xvz', '.sldd', '.slddc',['.' mexext]});
3) You will get regfile MatlabFileAssocFix.reg, run it
4) Restart pc or kill explorer.exe and run it again
5) Finish

Erwin Hoogerwerf

Zhixiong Zhao

It works for 2016a! Thanks


trad123 456asd

It does work for MATLAB R2017b, but Windows 10 1709 RTM 16299.15 (Fall Creators Update) HAS A F***ING BUG (AS ALWAYS) with the File Association and the Settings UWP....

trad123 456asd

It does Not work for MATLAB R2017b, Windows 10 1709 RTM 16299.15 (Fall Creators Update)

Yinqiao Wang

Works on R2017b

Junwoo Park

It works! @ Windows 10/ 2015a
1) Execute the included file(associateFiles.m)
2) New registry file(.reg) is generated, [MatlabFileAssocFix.reg], where the above m file is located.
3) Execute the registry file
4) Restart the PC

Kallol Bera

Thank you very much. It worked. You saved my day. Following these instructions from Yannis Gr:
"A bit more help on how you should do this.
1)Download the file
2)Extract the file @ C:\Program Files\MATLAB\R2016a\mcr\toolbox\matlab\winfun\private . Change the R2016a according your version of course.
3)Navigate inside matlab to the same dir as above. (Run matlab as admin also)
4)Execute the command associateFiles('add',{'.m','.mat','.fig','.p','.mdl',['.' mexext]});
5)Take the .reg file it will create copy paste on desktop and run it.

%% This is the part which works with most of MATLAB File associations

associateFiles('add',{'.m', '.mat', '.fig', '.p', '.mexw64', '.mlapp', '.mltbx', '.mldatx', '.req', '.mlappinstall', '.mlpkginstall', '.mdlp', '.slxp', '.mdl', '.slx', '.sltx', '.ssc', '.mn', '.mu', '.muphlp', '.xvc', '.xvz', '.sldd', '.slddc',['.' mexext]});"

Christoph Neukamp

Huayan Wang

Wei Chen Esmonde Lim

Worked on R2017a. Better than any MATLAB Answers. Thumbs up!


Worked with R2015a on Windows 10, though you have to confirm .m-files to be open with MATLAB (the typical Windows popup)

Lin Ken

It works! Excellent!


Thank you!


Francesco Lonis

Worked on Matlab R2017b. Thank you. Following these instructions from Yannis Gr:
"A bit more help on how you should do this.
1)Download the file
2)Extract the file @ C:\Program Files\MATLAB\R2016a\mcr\toolbox\matlab\winfun\private . Change the R2016a according your version of course.
3)Navigate inside matlab to the same dir as above. (Run matlab as admin also)
4)Execute the command associateFiles('add',{'.m','.mat','.fig','.p','.mdl',['.' mexext]});
5)Take the .reg file it will create copy paste on desktop and run it.

%% This is the part which works with most of MATLAB File associations

associateFiles('add',{'.m', '.mat', '.fig', '.p', '.mexw64', '.mlapp', '.mltbx', '.mldatx', '.req', '.mlappinstall', '.mlpkginstall', '.mdlp', '.slxp', '.mdl', '.slx', '.sltx', '.ssc', '.mn', '.mu', '.muphlp', '.xvc', '.xvz', '.sldd', '.slddc',['.' mexext]});"

Francesco Lonis

Worked on Matlab R2017b. Thank you.

Gustavo Forte

Florian Rothermel

ahmad eldeeb

how it works in matlab 2016b on win7?



Thank You!!!

Brandon Armstrong

Works on R2017a with the caveat that .mlx files (MATLAB Live Scripts) are supported. As stated, was tested on R2012a and R2015a so to be expected.

Juan Dionicio

Excellent on 2016b



Your file solved the problem that bothered me for a long time. Thanks a lot.

Huihua ZHAO

Works like a charm. Thank you so much!

zhenhua Li

Rui Zhang

Thank you so much dude! It works perfect on win 10 x64 R2015b!

Logia Uchiha

GJ! Works on Win 7 x64 R2016b! Thanks!!!

Ahsan Abbas


Khris Griffis

Works on 2017a here. Running MATLAB as Admin (win10) does the trick. To get the matlab icons to show up, right-click on one of the newly associated files (.m or whatever) go to Properties. Click "Change" next to Opens With and select the MATLAB 201x* option which be at the top of the list (and have "New" next to it). Do that even if MATLAB 201x* alreadyappears next to Opens With.

*x denotes your version of MATLAB.

Francisco Rodriguez

Works like a charm!, great work!

sercan demirkiran

Thanks a lot Patrik. You are champ!

Shreeprasad Bhat


Works on r2015a thank you! How can we shows the default icon for the files?


Good, it works on r2017a. However, .m files do not shows the default icon of MATLAB.

Le Quan

Efe Ilicak

Worked like a charm! Thank you Patrik!


Islam Alam

Worked on MATLAB R2017a
Answer by Yannis Gr. on 16 Jun 2016
Edited by Yannis Gr. on 16 Jun 2016
A bit more help on how you should do this.
1)Download the file
2)Extract the file @ C:\Program Files\MATLAB\R2016a\mcr\toolbox\matlab\winfun\private . Change the R2016a according your version of course.
3)Navigate inside matlab to the same dir as above. (Run matlab as admin also)
4)Execute the command associateFiles('add',{'.m','.mat','.fig','.p','.mdl',['.' mexext]});
5)Take the .reg file it will create copy paste on desktop and run it.

%% This is the part which works with most of MATLAB File associations

associateFiles('add',{'.m', '.mat', '.fig', '.p', '.mexw64', '.mlapp', '.mltbx', '.mldatx', '.req', '.mlappinstall', '.mlpkginstall', '.mdlp', '.slxp', '.mdl', '.slx', '.sltx', '.ssc', '.mn', '.mu', '.muphlp', '.xvc', '.xvz', '.sldd', '.slddc',['.' mexext]});

Tugrul Artug

Worked on Win10 R2016a. Thanks.

Nick Durkee

Didn't work on Matlab R2017a


YanXin Zhang

It works perfectly in Matlab R2015b in Windows Server 2016! Thanks!

Works amazingly well Thank You! r2016a windows 8.1 x64

zhu zheng

good job
works for r2016b windows 7


Works like a charm! r2015a, Windows 10 64 bits.


Thanks! It works in Matlab R2016a in Windows 10!


Works for R2016b! Thanks a lot !


Edgardo Villar

It works perfectly in Matlab R2016b in Windows 10! Thanks!



Germano Scarabelli

Great work. Perfect for R2015a.

Gorky Shaw

perfect for R2016b

kaushal sharma

ann chen

works perfect on MatLab 2016a in Win7!


Perfect! Thanks!

Antoine Bahizi

It works on MatLab 2016a. it saved my time. Thank you.

Pedro Busc

Jhacson Meza

Xiangyi Yu

It works, one line sublime fix.

Sérgio M. A. Cruz

Excellent! It solved my issue!


Super Effective!!!

ahmed ahmed

the File is good. but the method given by karim baa is the best
thank you very much,
i tried it with 2015a

karim baa

Perfect works on 2016b\win10, just follw all the steps : 1)Run "associateFiles.m.", 2) Exit matlab, 3) double click generated "MatlabFileAssocFix.reg", 4) restart pc.

wei-quan chen

Excellent!! Perfect!!
Thank you very much!!

yang hong


wenyu yang

Zvonimir Fuduric

Mustafa Al-Qaisee


Thanks a lot. I was about too reinstall Matlab just to fix this stupid file association. But this saves me a lot of time and efforts. I can' thank you enough.

Jianhua LIU

great! works well @ win7 2016a

Yang Yao

Nice job

felix cyc




Masoud Rezazadeh

Thanks Patrik
It's nicely work for me

Zhang Liang

Wish that .mlx file would be associated.

Gene. Lin

maybe my matlab was bad T.T , It's not working. still thank you .



Mohamed Kassab

thank you so much, worked perfectly

Ermin Gong

perfectly figure it out, fatastic!!!thank you so much! matlab2016b,win10

Jerome Kodjo

Works perfectly for R2013a on Windows 8.1. Nice job! Thanks.

Bryan Jin

Works for R2016b, windows7.

Hakan Erdol

Solved my problem. Thanks Mathworks


how to associate live scripts "*.mlx" files please?

Iasonas Tselos


It worked!!


Thank you so much!


Thanks! Helped as accepted 2015a

Fan Hi

Thanks, but it doesn't seem to work on 2016b(Win10 x64 1067)

Bilal Yuruk


lang xiaozheng



Doesn't seem to work with R2016b on Win10


Vikrant Karale

Nice Job. Thanks for making it so easy.



npn bkck


worked for MATLAB 2016a, thanx very much.:)

blue bird

Works perfect with R2016b. If the .reg file won't work, just copy it into another folder and start it.

Baptiste P

Thanks !!

Ali Mahdavi

2016a - Windows 10, Worked. Nice!

Vaibhav Deshmukh

This doesn't work for 2016b. Can you help me with this?

Dimitrios Ataloglou

Excellent work! Thanks!

Mushfequr Rahman


João Brito

Antoine Bahizi

Thank you. It worked on Matlab 2016a on Windows 10 Pro.




thanks bro!! It worked on Matlab 2015b on windows 7


It works very well for me! Thanks a lot!

Antonio Morales

Excellent! Thanks very much!

Igor J.

Thanks very much!

Santiago Molina

Thomas Thuruthel


Fixed my problem of a new MatLab session being started every time I open a m file. Life Saver!

Darien Gonzalez


Worked on Matlab R2016a on Windows 10 64bit


Pi Ting


Michele Scalseggi

Mohamed Atyya

slx files is not associated

Mohamed Atyya

Carla Barquest

Jiangtao Yu

Thanks very much!
It work for Matlab r2016a on Windows 10 (1607).

Jordan Stoyanov


Bo Di


works win 7 R2016a

Ruban Sugumar

Works perfectly for R2016a. Thank you Patrik Forssén.


Khris Griffis

Great submission! Still works 2015b (student) Win10x64.

L Amy

Thanks a lot!

Yannis Gr.

works great but it left all my .fig .m icons blank white.

Ken Garrard

Thank you! This is much better than re-installing R2016a. Curiously, it removed R2012b from my open-with menu but R2014a, R2014b, R2015aSP1 and R2015b are still there.

firas firas

It's working for me(R2016a) but you have to run the created 'MatlabFileAssocFix.reg' file outside matlab manually.
Great job thank you

Witu Witukas

Carmine Gno'

Thanks a lot! A much needed fix!

Guido Marco

Excellent!! it works very well (Matlab 2015b - Windows 10)


Fantastic.It works well on windows 10 for matlab 2016a. Thank you!!


Fantastic.It works well on windows 10 for matlab 2016a. Thank you!!

Bin Du

Amazing! windows10 and Matlab2016a, it works!

Fang He

Carlos Colon

WOW thanks so much buddy!! Works with R2016a in Windows 10.


Thank you!! Worked perfectly!


Absolutely Brilliant! Solved the problem...

Alex K



how can I download it?

keyur patel

Ali Alalfy

Zhiyi TANG

works with MATLAB 2016a, Windows 10 X64

Brendan Hamm

Absolutely brilliant! You may want to consider having this allow multiple versions of MATLAB as you can no longer choose older versions for the Default afterwards without of course deleting the current default. It would be nice to be able to do this in Windows still afterwards.

Zhipeng Cao

Thanks! Problem solved.

Denis Anikiev

Muhammad Abdulrasool

man, you are amazing.
It's work with me and it is fantastic.

Hakim Cheikh

Antonio Fortes


Alexander Fedirko


I can't even count how many hours over the years I've been frustrated by this silly problem, and all the failed suggestions in various forums, including mathworks. Thanks for this submit, A+++

Liam Daly

Biagio Sca

hi, not work on my Matlab version



Wojciech Glapiak

Ganesh Sivaraman

Tom Mot

Heriberto Sanchez

Gracias =D !!
Funciona perfectamente
Matlab 2015a | win 10
OJO: Si crees que no funciona, solo hay que leer las instrucciones que están dentro del archivo .m


Thanks!!! Worked perfectly!!!
Matlab 2015a and Windows 10

jose verdugo

Muchas Gracias!!! Funciono a la perfección Matlab 2015b

jeff grahams

please help, new to matlab , how do i add this file to matlab path so that it correct the file association issue, thanks

Pedro Busc

Jose Quintero


Unbelievable. Amazing.!!! It works even with 2015b. I screwed up my pc before use this script but it fixed all the bugs. Thanksxx

firstname lastname

Josh Parks

thanks man, cakewalk. Can't believe windows doesn't do this automatically, mac has no issues

Faker Black

worked well


Allan Fong

wow okay, I commend you for this - most of lifelong problems now solved :D




Thank you for the solution. It work very well


I am really disappointed that this didn't work either. I am using R2014b and associated file is still the Starter Application, and clicking the .m file right now only opens a new instance MATLAB, not even a new instance of MATLAB with its editor open with the file. I'd be happy to hear any suggestion anyone gives.

H. Birkan

Tried many things for R2015a and this one worked perfectly, thanks

Manolis Trypakis

Worked perfectly. Had tried a lot of different proposed solutions in the past but this is the only one that actually worked (2015a). You saved me a lot of headaches :) Thanks!

J. Domann

worked perfectly



Frederik Boehle

MATLAB Release Compatibility
Created with R2020a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!