CitizenInsane
CitizenInsane

Reputation: 4875

Change matlab path on startup (On a PC platform)

I'm working on 2 branches in SVN and I'd like to have 2 shortcuts (or 2 .bat files) to start matlab with path correctly defined upon the branch I'm currently working with. For instance:

[Matlab-trunk.bat] ==> Would look for some pathdef-trunk.m
~matlabroot\toolbox\matlab\apps
~matlabroot\toolbox\matlab\audiovideo
~code\trunk\MyToolboxes\Common
~code\trunk\MyToolboxes\Miscellaneous
~code\trunk\MyToolboxes\etc\etc ...

[Matlab-BranchLala.bat]  ==> Would look for some pathdef-lala.m
~matlabroot\toolbox\matlab\apps
~matlabroot\toolbox\matlab\audiovideo
~code\branchlala\MyToolboxes\Common
~code\branchlala\MyToolboxes\Miscellaneous
~code\branchlala\MyToolboxes\etc\etc ...

I have read this thread:

How to run two MATLAB instances simultaneously with different pathdef's?

And I like the solution where I would simply have to define for MATLABPATH environment variable before to start Matlab ... but it seems this only works for Unix\Mac platforms ... maybe I should mimic similar idea by manually editing the matlabrc.m file ... or maybe you have a better idea ?

EDIT

Humm ... maybe I should dynamically switch startup.m file before to start and add a matlabpath(...) in there ... but I don't know where it is stored, the command userpath is returning `` on my PC.

NB1: I'm working with Matlab R2013b on a PC platform

NB2: I cannot move to git do in-place branch-switching for now on (this was one solution I though about).

Upvotes: 0

Views: 92

Answers (1)

Shai
Shai

Reputation: 114976

You can define different startup folders for each of the shortcuts.
Then, at each different startup folder define pathdef.m file with the different paths.

Upvotes: 2

Related Questions