just setup a script to run depending on the project you are working on in your root matlab directory. One for Project A and one for Project B. In each script use the function addpath()/path() to add your paths and cd() to navigate to the location of the project. I forget which one is temporary such that the next time you start up matlab it resets. In these scripts you can also call functions located in the file exchange which will save and load command histories. So perhaps 2 scripts can be run.
to recap project startup script:
- add paths to matlab search paths
- load command history from file X (if no file then keep current history)
- navigate current directory to project path.
then another script to be called:
- remove paths added in project startup script
- save current command history into file X.
- navigate to default matlab folder?
the 2nd script could be used in the event you don't want to close matlab down and reset it to the default to start the other project.