Skip to content

MATLAB: Set working path at startup

Many times when MATLAB is started there is a certain program that you want to work on. In order to work on this program, the current directory or path of that program must be changed or set.  This little script here will prompt the user for the module to work on and then add that directory to the path listing. When MATLAB is terminated, that path will not be saved.

% startup.m

% Set Production Directoryprod='~/MATLAB/Production/';

% Prompt user for module namemodule=input('What module do you want to work on? ','s');

% If module is set, add to top of path. Otherwise don't addif ~isempty(module) path([prod,module],path);end
Place the startup.m in your MATLAB work directory.

Posted in Code, Matlab. Tagged with , .

0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

You must be logged in to post a comment.