How to restore file association in Matlab 2015a for Windows

7 次查看(过去 30 天)
The Matlab files are no more associated with Matlab.
In the previous version I have run the Application as Administrator and typed these commands
cd([matlabroot '\toolbox\matlab\winfun\private']);
fileassoc('add',{'.m','.mat','.fig','.p','.mdl',['.' mexext]});
disp('Windows file associations changed. FIG, M, MAT, MDL, MEX, and P files are now associated with MATLAB.')
If I try the same in Matlab R2015a doesn't work and give me the error Undefined function or variable 'fileassoc'.
If I try to associate the file type using right click directly on the .m file and choosing open with Matlab with the use always option enabled, the files appears associated but when I try to open the file, Matlab starts but doesn't open the file so I'm forced to start Matlab and open de file from open menu.
How could I fix this problem?
What happened to fileassoc command?
I'm on Windows 8.1 x64


Patrik Forssén
Patrik Forssén 2015-6-12
I’ve just submitted a contribution to MATLAB FEX that can solve this problem for R2015a (and earlier versions): MATLAB File Association Fix
  4 个评论
zengshuishui 2017-7-13
Thank you very much . This trouble bothering me for a ;ong time!
Qian Geng
Qian Geng 2018-1-3
It works on my 2017b version very well. Long searching for this solution and finally got it. Thx.


更多回答(5 个)

Yannis Gr.
Yannis Gr. 2016-6-16
编辑:Yannis Gr. 2016-6-16
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.
  8 个评论
Cosmin Constantin Popescu
It worked by it required to unzip the archive directly in the specified folder (and in a new folder but that was just a default in my case). When I first run the registry file, I had a MATLAB instance open and the .m files opened externally ignored it. Instead, they all opened in a second MATLAB instance. At least that instance now behaves as expected. Thank you for the help and explanations!


Murat Ates
Murat Ates 2015-3-20
Copying 3 fileassoc files from
C:\Program Files\MATLAB\R2014b\mcr\toolbox\matlab\winfun\private
to the corresponding R2015a folder and running
fileassoc('add',{'.m','.mat','.fig','.p','.mdl',['.' mexext]});
on 2015a in the corresponding folder worked for me. Then you are able to see R2015a in the Windows default programs list i.e.
Control Panel\All Control Panel Items\Default Programs\Set Default Programs
Matlab starter's icon disappeared though. I checked registry of Windows, and command just mirrored whatever is done for 2014b to 2015a.
If you don't have those 3 files, you may export registry settings for Matlab in 2014b, modify and run it if you installed 2014b on that machine. Backup whole registry before doing this. Registry settings are located at:
  1 个评论
Andrew Farsech
Andrew Farsech 2015-3-22
The problem is that now I have installed only the R2015a and I'm not authorized to install any previous version on this pc... could you upload fileassoc files? I have contacted the official support but still no answer.


cai6328 2016-3-3
It worked for me. THanks

federica cirillo
federica cirillo 2018-1-31
编辑:federica cirillo 2018-1-31
it doesn't work for me! I obtain "Failed to create registry file". can you help me? I'm using R2017a version
  1 个评论
Quentin Guillaumin
I had the same issue, add a path to indicate where to save the registry such as 'C:\Users\bob\Downloads\regisry' in the fileStr entry of the function, I worked for me.


Rehan Qasim
Rehan Qasim 2019-6-24
what about .mlx files ?


Help CenterFile Exchange 中查找有关 Introduction to Installation and Licensing 的更多信息


Community Treasure Hunt

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

Start Hunting!

Translated by