Main Content

Import Preferences From Other Releases

When you start a newly installed version of MATLAB®for the first time, it attempts to import your preferences from a previous release installed on your system. MATLAB looks for preferences folders according to these guidelines.

  • MATLAB looks for a preferences folder for release R2019b or newer. If MATLAB finds one or more preferences folders matching that criteria, it migrates the files from the most recent version.

    For example, if you start R2021b and preferences folders exist for both the R2020b and R2019b releases, then MATLAB migrates the files from the R2020b preferences folder to the R2021b preferences folder.

    Note

    For releases before R2021b, MATLAB looks back three releases. For example, if you start R2019a, MATLAB looks for preferences from R2018b, R2018a, and R2017b.

  • If a preferences folder does not exist from a valid previous release, then MATLAB creates the default preference files for the release starting up.

    For example, if you start R2021a, MATLAB looks for preferences for versions R2020b, R2020a, and R2019b. If none of those is installed, MATLAB creates the default files for the R2021a release. This is true even if a preferences folder exists for the R2019a release or earlier.

  • If you install a release older than the current version, MATLAB does not import preferences from releases that are newer than that release.

To see the full path for the preferences folder, typeprefdirin the MATLAB Command Window. The name of the preferences folder matches the name of the release you are running. For example, for MATLAB R2021a, the name of the preferences folder isR2021a.

prefdir
ans = 'C:\Users\username\AppData\Roaming\MathWorks\MATLAB\R2021a'

macOSand iOS, the preferences folder might be inside another folder that is hidden. If so, to access the hidden folder:

  1. In the Finder, selectGo>Go to Folder.

  2. 在结果的对话框中,键入返回的路径prefdir, and then pressEnter.

Use Default Preferences

Instead of importing preferences from a previous release, you can use the default preferences for the new release. To use the default preferences, delete all of the files in the preferences folder for the corresponding release. Use theprefdircommand to determine the full path of the preferences folder.

例如,要使用R2021A的默认首选项,启动MATLAB,在命令窗口中,键入prefdirto determine the location of the preferences folder.

prefdir
ans = 'C:\Users\username\AppData\Roaming\MathWorks\MATLAB\R2021a'
MATLAB, folde删除所有的文件rC:\Users\username\AppData\Roaming\MathWorks\MATLAB\R2021a, and then start MATLAB again. MATLAB starts with all preferences set to their default values. One file to consider keeping ishistory.m. For more information, seeSet Command History Preferences.

另外,如果您尚未启动新版本,请为其创建一个空的首选项文件夹。这将防止MATLAB在打开新版本时导入首选项,并强迫它使用默认的首选项。例如,使用MATLAB R2021A的默认首选项,如果您的MATLAB首选项存储在C:\Users\username\AppData\Roaming\MathWorks\MATLABfolder, create the folderC:\Users\username\AppData\Roaming\MathWorks\MATLAB\R2021a.

See Also

|

相关话题