Be the first to rate this file! 0 Downloads (last 30 days) File Size: 1.72 KB File ID: #16088

Project-specific preferences, settings, and history

by Petr Krysl

 

24 Aug 2007 (Updated 24 Aug 2007)

How to use project-specific Matlab and preferences, settings and history.

| Watch this File

File Information
Description

Project-specific Matlab preferences/settings/history

Solution by Petr Krysl.

Most of the time, I use or develop two, three, or more Matlab projects.
For each I like to have their separate settings: list of open files, list of visited folders, command history, shortcuts, and so on.

My solution is to fire up Matlab (under Windows) by double-clicking a batch file, which sets the UserProfile environment variable before invoking Matlab. Thus, Matlab is informed where to find its settings in this particular instance.

One can run several instances of Matlab, each with its own set of preferences, settings, and history.
 
The project-specific settings I put into a project folder. For instance, one of my projects is in the folder SA_tools with the following structure:

SA_tools
  |---profile
  |---beam
  |---truss
      start.bat
      SA_tools_init.m

The folder "profile" holds the Matlab preferences that I want to use for this project (it may be created by copying the default preferences
folder: use the Matlab command prefdir to find it; otherwise, Matlab can create this folder if it doesn't exist, and one can then tweak the
preferences in any way they like).

The batch file "start.bat" first sets the environment variable, and then invokes Matlab. The contents of this file are:

  set UserProfile=%cd%\profile
  matlab.exe /nosplash /r SA_tools_init

Double-clicking start.bat I bring up Matlab, telling it to load the preferences from the SA_tools\profile folder, and to initialize the
project settings by running SA_tools_init.m.

MATLAB release MATLAB 7.4 (R2007a)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (1)
27 Aug 2007 Peter Giles

This is an interesting idea and one I will use.

I had to do a little tweaking on my own to make it work, though. In my installation the preferences directory is constructed from the UserProfile environment variable, plus a subfolder structure (ApplicationData/MathWorks ...) which I couldn't figure out how to change. So if you want to copy your preferences from one project to another you have to copy the entire structure and not just the contents of the folder returned by prefdir().

Also, one annoying side effect -- each "project" so defined will have its own helpdesk favourites, which is probably not that useful.

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
development environment Petr Krysl 22 Oct 2008 09:24:25
preferences Petr Krysl 22 Oct 2008 09:24:25
history Petr Krysl 22 Oct 2008 09:24:25
userprofile environment variable Petr Krysl 22 Oct 2008 09:24:25

Contact us at files@mathworks.com