How do I associate file types with a certain application?

38 views (last 30 days)
I would like MATLAB files with the ".m" extension to open automatically with the MATLAB Editor/Debugger when I double-click them. I would also like MDL-files to open in Simulink when I double click them.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 7 Mar 2017
Some operating systems associate file extensions with specific programs/applications, and opens a file based on that association. Below are general instructions for changing these settings:
For Windows 8, Windows 10, and if the file extension is not in a list of file extensions:
1. Right click on any .m file in Windows and select Open With.
2. Select the More Apps option to show a full list of programs installed on your computer.
3. Select MATLAB and make sure the box at the bottom is checked that says "Always use this app to open .m files"
For Windows 7:
1. Right click on any .m file in Windows Explorer and select Open.
2. The above will show two options. Select the one that says "Select a program from a list of installed programs" and hit OK.
3. With the checkbox "Always use the selected program to open this kind of file" on, choose MATLAB as a program you want use to open .mat file. MATLAB.exe should be located at:
$MATLABROOT\bin\win64 (assuming this is on Windows 7 64-bit)
where $MATLABROOT is the MATLAB root directory on your machine, as returned by typing
matlabroot
at the MATLAB command prompt.
After the above steps, you should be able to see the .mat extension in the list besides other file extensions.
For Windows Vista:
1. From the Windows "Start" Menu, go to "Settings". Choose "Control Panel" and then open the "Default Programs" control panel.
2. Select "Associate a file type or protocol with a program".
3. Scroll down to file type you would like to associate and select it. For example, if you would like to associate your MATLAB script/function files with the MATLAB 7.4 (R2007a) Editor/Debugger, you would select "M File".
4. Select "Change Program".
5. In the "Open With" window, select the executable file for the application with which you would like to associate the ‘.m’ file type. For example, to open MATLAB script/function files with the MATLAB 7.4 Editor/Debugger, select the "meditor.exe" file in $MATLABROOT\bin\win32 where $MATLABROOT is the MATLAB root directory on your machine, as returned by typing
 
matlabroot
at the MATLAB command prompt.
If the executable is not listed, click on the "Browse" button and locate the executable.
6. Click the "OK" button.
7. Click the "Close" button in the "Folder Options" window.
For Windows XP and MATLAB 7.0 (R14) and later:
1. From the Windows "Start" Menu, go to "Settings". Choose "Control Panel" and then open the "Folder Options" control panel.
2. Click on the "File Types" tab.
3. Scroll down to file type you would like to associate and select it. For example, if you would like to associate your MATLAB script/function files with the MATLAB 7.4 (R2007a) Editor/Debugger, you would select "M File". If the file type you want does not exist, you can make a new type by clicking on the "New " button. Just add the "File Extension" and "Associated File Type" and Click OK.
4. Click on the "Change" button.
5. In the "Open With" window, select the executable file for the application with which you would like to associate the ‘.m’ file type. For example, to open MATLAB script/function files with the MATLAB 7.4 Editor/Debugger, select the "meditor.exe" file in $MATLABROOT\bin\win32 where $MATLABROOT is the MATLAB root directory on your machine, as returned by typing
 
matlabroot
at the MATLAB command prompt.
If the executable is not listed, click on the "Browse" button and locate the executable.
6. Click the "OK" button.
7. Click the "Close" button in the "Folder Options" window.
For Mac OSX 10.6:
1. Open a New Finder Window and browse to a file of the type you'd like to change the extension.
2. Click on the file. Go to File in the top left and select "Get Info".
3. Go to "Open With" and expand that section.
4. Click on the drop down and select the program you'd like this file type to be associated to.
5. Click on the "Change All" button and "Continue"
  1 Comment
Brendan Hamm
Brendan Hamm on 18 Apr 2016
Edited: MathWorks Support Team on 24 Sep 2022
There is also an issue where your Windows Registry may not allow you to choose a later version of MATLAB for file association. I found a nice File Exchange pick which will create a .reg file to solve this: matlab file association fix

Sign in to comment.

More Answers (0)

Categories

Find more on File Operations in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!