MATLAB Community

MATLAB, community & more

Getting to your configurations 9

Posted by admin,

Back when we introduced configurations in R2007b (see this blog entry), one of the first questions brought up by customers was “where are the configurations stored and what format are they in?”. A completely understandable request, as it can be disconcerting to put time and energy into something and not know what controls the fate of your hard work (i.e. what happens if I upgrade MATLAB or move to another machine?).

We heard your requests and have made both run and publish configurations accessible. You can find your configurations by cd‘ing to prefdir:

>> cd(prefdir)

You’ll find a number of files in this directory – the two we’re interested in are run_configurations.m and publish_configurations.m. These two files are both MATLAB files that use cell mode. You can open up the raw run and publish configuration storage files in the MATLAB editor for viewing, but you shouldn’t edit these files directly (see note below).

NOTE: Do not edit run_configuration.m or publish_configuration.m within the MATLAB Editor – use either the Configuration Editor, or modify the files from a text editor when MATLAB is not running.

Here’s what the beginning of my run_configurations.m file looks like:

% MATLAB Run Configurations
% @version 2
% It is recommended that you do not edit this file directly, but use the
% Configuration Editor provided in MATLAB. Changes made to comments that
% exist outside of a configuration will not be saved.

%% @name foo
%  @associatedFile /mathworks/home/korr/Desktop/foo.m
%  @mostRecentlyActioned false
%  @uniqueId -4e3eabb0:11a2a50508e:-7f8f

% Modify expression to add input arguments.
% Example:
%   a = [1 2 3; 4 5 6];
%   foo(a);

x = 1:100;
disp('Done running foo.');

You can share this file with others, though there currently isn’t a way to import another run or publish configuration file. With MATLAB shutdown, the receiving user can either copy and paste the desired configurations into his own configurations file or rename his configurations file from run_configurations.m to something like run_configurations_old.m.

If the receiving user doesn’t have a MATLAB file that a configuration is linked to, the Configuration Editor will indicate the problem by placing a red x next to the file name:

To fix this problem, point the Configuration Editor to the MATLAB file that the configuration corresponds to by editing the Associated M-File text field, or by clicking Choose… to navigate to the file.

We’d love to here what enhancements you would like to see in the Configuration Editor!


Comments are closed.

9 CommentsOldest to Newest

Sung Soo Kim replied on : 1 of 9
Hi Ken, I found this site today, and I love it! BTW, I have a question related to desktop configuration. I'm currently doing two completely separate projects, and I want to open completely two separate Matlab workspace and desktop so that I don't have to be confused by mixed list of m-files from two exclusive projects. For example, one matlab desktop with "current directory" of the first project, and opened m-files only related to that project. And the other matlab desktop with "current directory" of the other project and related to only the second project in the editor. For now, I made two Windows accounts and switching user to use separate configuration for each project, which is really uncomfortable, because I couldn't find a way to keep two completely separate desktop configuration. Each instance of matlab saves only one information about opened m-files, current directories, and so on. Even though I can use separate configuration files, the list of opened m-files etc cannot be saved separately. Is there a way to accomplish my goal?
Ken replied on : 2 of 9
Hi Sung Soo Kim, There's not a great solution right now for what your trying to do. We do have a team looking at your specific use case and assessing how best to address that in the MATLAB Desktop. Sorry I don't have a better answer for you! -Ken
Sung Soo Kim replied on : 3 of 9
Thank you for your fast reply. It is good to hear that there is already a team for such requirement. But let me add some words if you don't mind. I've been thinking about this for a while, and in fact, I think project managing window (in addition to the "current directory window") will do the job. As you well know, IDEs of genral purpose programming languages have project files to store all information of a specific project. If Matlab desktop have that functionality, it'll help users a lot. I don't think you have to change the current matlab interface (which is fantastic and volatile), but you can just add a small window for projects and add some options that users can modify. That window may contain tree structure of projects, in which m-files may not necessarily stored in tree structure in the real operating system, I mean the tree structure is just for organization purpose, and a user can move m-files around the tree structure as s/he wants (but not in the real file system to keep the path, or user can choose that by option). You can also add an option to close or open all project-specific m-files in the editor window. The project file can also save the desktop configuration or layout information for that project. Workspace can be saved or not depending on the option. Path information specific to the project can be stored as well. All of this can be done without modifying any user interface nor functionality of current matlab version. And I imagine that it may not require major desktop upgrade either. I guess it may require change of the way that current matlab desktop is using to save configuration information in the (I guess) registry, so that all those information now should be stored in a file not in the registry. But still, it doesn't have to touch any thing of the matlab core. Furthermore, I heard about sort of service functions that matlab desktop provides to maybe open public. If that is true, most of these functions can be done with a simple window that is controlled by m-file which is using those service routines, although I don't know if that is true. In this case, layouts or desktop configuration may not be saved but all major project-related features like open m-files, current directory information, tree structure, project-specific path information etc still can be achieved easily. Anyway, advantage of this light weight project managing functionality is huge as you can imagine. Current users or learning students don't have to worry about this addition if they don't want to know. In fact, the way the current desktop functions is very good for quick and simple tasks. But serious engineers who need to control their code base (many engineers actually suffer from their messy m-files and user-defined libraries scattered around here and there) will appreciate it a lot. It also makes the codes portable and interchangeable across colleagues. You know, matlab is not just for college homework projects. Every serious engineers use it, but their m-files are usually not organized. With this simple tool (plus the debugging feature that is currently in the desktop), the matlab desktop will become a serious integrated development environment.
Georg Wiora replied on : 5 of 9
I found two major problems with configurations: 1. They sometimes disappear or are changed on restart of matlab 2. The configurations should be stored in the project directory. First to make it accessible to a source code management system like subversion and second to share it easily with other project contributors.
Ken replied on : 6 of 9
Hi Georg, Re. 1: What do you mean by "They sometimes disappear or are changed on restart of matlab"? Can you give specific examples? No configurations that you created should ever be changed or lost across MATLAB sessions. Re. 2: This is an interesting thought. I'll create an enhancement request for this. -Ken
Georg Wiora replied on : 7 of 9
Re. Re. 1: They definitely disappear on a matlab crash, because they seem not to be stored before matlab is terminated. My uptimes for matlab are very long (days to weeks) and I rarely terminate it because the startup time is *long*. So this hits me maybe more often than other users. Concerning the "changed" configurations, I just found out that they are maybe specific to the file path. When I store that same m-file in a different location with the same name, I have to create a new configuration. The solution I pointed out in (2) would also solve this problem. Georg
Ken replied on : 8 of 9
Hi Georg, Configurations should be saved automatically when the Configuration Editor is closed. Do you leave the Configuration Editor up? -Ken