The Preferences folder: matlab.prf
Continuing my discussion on the MATLAB Preferences folder, today’s article is about one particular file in that folder. (Remember you can find the folder location with the prefdir command). That file is matlab.prf, which stores the changes you’ve made to your preferences from the Preferences panel. This file is just a simple list of the various preferences altered from their default with their new value, encoded in a way that makes sense to our preferences code. Even though it’s ASCII, the file is not meant to be human readable, but if you look closely, I’m sure you can figure it out.
Between releases, you shouldn’t rely on the continued existence of any particular key or value type, as we often change these from release to release. Knowing about this file is useful when manually managing different preference sets or manually upgrading. For example, since you can’t have multiple preference directories, you can set up one session of MATLAB how you like it, copy the matlab.prf file to safe location, and repeat for as many configurations as you wish. To switch between them, you have to manually copy the saved .prf file back into your preferences directory. Obviously this is annoying and does not work well if you have to switch often. This workflow is more useful for sharing preferences; that is, copying the file from one user’s prefdir to another’s. (Note since the prf file contains paths to other files those files may not exist on the new user’s computer, or may be incompatible with their system).
If you skip a release or two and don’t get your preferences automatically carried up, you can try copying the matlab.prf from the old preferences folder to the new one. I can’t guarantee that will work or won’t prevent MATLAB from starting properly, so please back up the original one first. Deleting the file or replacing it with a working backup will fix any issue caused by copying a different prf file.
MATLAB caches the preference values once it reads the prf-file; if you manually modify this file, you’ll have to restart MATLAB to see the effects.
- 类别:
- Preferences
评论
要发表评论,请点击 此处 登录到您的 MathWorks 帐户或创建一个新帐户。