Documentation Center

  • Trial Software
  • Product Updates
我们为许可用户提供了部分翻译好的中文文档。您只需登录便可查阅这些文档

Associate Files with MATLAB on Windows Platforms

When you install MATLAB® on Windows® platforms, the installer sets up associations between certain file types and MathWorks® products. When you double-click a particular file type, identified by its file extension, Windows starts MATLAB and opens the file in the appropriate tool. The following table lists the file extensions associated with MathWorks products and the behavior that results from this association.

File Extension and Resulting Action

File ExtensionResult
.figOpens file in figure window
.mOpens file in Editor
.matOpens Import Wizard to load the data into the MATLAB workspace.
.slx, .mdlOpens file in a Simulink® model window
.mex[a]Displays icon for MATLAB in Windows Explorer tool
.pDisplays icon for MATLAB in Windows Explorer tool

[a] MEX-file extensions are platform-specific. See Using MEX-Files.

File associations for the Windows Explorer tool do not affect what happens when you open one of these file types from within MATLAB. MATLAB acts on the file using the MATLAB tool associated with that file type.

For example, if your system associates .mat files with the Access™ application, when you open a MAT-file from within MATLAB, it opens the Import Wizard to load the data. To open a .mat file with the Access application, right-click myfile.mat, and from the context menu, select Open With, then the Access application.

To associate a different file type with MATLAB, use the Windows Default Programs control pane. On Windows 7 systems:

  1. Click the Windows Start menu.

  2. Select Control Panel.

  3. Select Programs.

  4. Select Default Programs.

  5. Select Associate a file type or protocol with a program.

  6. In the Set Associations window, find the file extension in the displayed list and double-click it

  7. To change the default association, click Change Program. The Open with dialog box opens, which lists other programs that might be recommended for this file extension. If it is a file extension associated with MATLAB, such as .mat, the list includes all the versions of MATLAB you have installed.

  8. Click OK in the Open With dialog box.

  9. To close the Set Associations window, click Close.

For more information about using the Default Programs control pane, see your Windows documentation.

Sometimes double-clicking a MATLAB file in Windows Explorer opens a new instance of MATLAB. To work around this issue, uninstall versions of MATLAB, release R2010a or earlier. Then reinstall MATLAB R2010b or later.

Alternatively, change the security setting on the matlabroot\toolbox\local\pathdef.m file to allow the Users group to write to the file. For more information, see http://www.mathworks.com/matlabcentral/answers/93468-why-is-a-new-instance-of-matlab-opened-when-i-double-click-on-a-matlab-file-in-windows-explorer-even.

Was this topic helpful?