How can I setup MATLAB to differentiate things like recent directories and command histories for two unrelated projects?

3 ビュー (過去 30 日間)
I work on two separate and unrelated projects and I have separate directory locations I frequent, separate desired paths, and separate programs and commands I run for each one. Is there a way to have two different "personalities" within MATLAB to work on one project versus the other? I previously had two separate versions of MATLAB loaded on my computer and would use one version for Project A and one for Project B. I now only have one version and am wondering if I can recreate the separateness of things like paths and command histories. Thanks!

採用された回答

Ken Atwell
Ken Atwell 2015 年 6 月 3 日
I don't think there is direct support for like this you describe. Path management can be semi-automated with scripts, but command history in particular is a "global" resource.
If you really want to have two personalities, you could consider managing two different areas for your MATLAB preferences. See this topic, but be sure to read through the limitations and caveats.
  1 件のコメント
Scott Francis
Scott Francis 2015 年 6 月 4 日
編集済み: Scott Francis 2015 年 6 月 4 日
That's interesting...I wasn't aware of the MATLAB "preferences" folder. I think that may have worked and started researching it, but I took the lazy route and just had another version of MATLAB installed on my machine again. I still learned something from your post, so thank you!

サインインしてコメントする。

その他の回答 (1 件)

Joseph Cheng
Joseph Cheng 2015 年 6 月 3 日
編集済み: Joseph Cheng 2015 年 6 月 3 日
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.
  1 件のコメント
Scott Francis
Scott Francis 2015 年 6 月 4 日
That's a great idea that I hadn't thought of. The main "issue" I see is that I'd have to be very diligent about saving my command history after every session, but it would work in a pinch. Thanks for your response!

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeFile Operations についてさらに検索

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by