在Linux中更改MATLAB的启动文件夹 [英] Changing MATLAB's startup folder in Linux

查看:287
本文介绍了在Linux中更改MATLAB的启动文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已按照

  • 我在.bashrc中导出以下变量:

    export MATLAB_USE_USERPATH=1
    

    在运行MATLAB之前,我可以使用echo $MATLAB_USE_USERPATH正确验证上述负载.

    I can verify the above loads correctly with echo $MATLAB_USE_USERPATH before I run MATLAB.

    我还从MATLAB运行了以下代码行:

    I have also run the following lines from MATLAB:

    userpath('reset')
    userpath('clear')
    userpath('/path/to/my/startup')
    

  • 但是MATLAB仍然在我的主目录中启动,而不是在/path/to/my/startup中.

    But still MATLAB starts in my home directory, and not in /path/to/my/startup.

    还有什么我需要做的吗?我可以在matlab.prf中手动编辑startup文件夹吗?

    Is there anything else I need to do? Can I edit the startup folder manually in matlab.prf?

    谢谢

    推荐答案

    我不知道执行此操作的常规方法,但是简单的方法只是将用户路径设置为个人脚本目录.

    I don't know the regular way to do this, but the easy way is just settings the userpath to your directory of personal scripts.

    在该文件夹中,放入一个脚本startup.m,该脚本包含:

    In that folder, you put a script startup.m which contains:

    cd /path/to/my/startup
    

    它可能看起来不太漂亮,但这使您可以根据其他因素来更改目录.我看到了一些示例,这些示例在启动时提示您您正在从事哪个项目?".根据个人输入,我会从不同位置加载设置,具体取决于MATLAB正在使用的计算机(家用计算机,我的大学中的个人计算机,大学中的计算机房等). )

    It might not look pretty, but this allows you to change the directory depending on other factors. I have seen examples of people who get a prompt at startup that asks 'Which project are you working on?' and depending on their input some files are loaded, the direcotry is changed, etc. Personally, I load settings from different locations depending on what computer MATLAB is working on (home computer, personal computer at my university, computer rooms at university, ...)

    也许只是一个小主意,可以帮助您解决这些变量:您始终可以尝试编辑Linux的MATLAB启动脚本(不是startup.m,而是which matlab).

    edit: Perhaps just a small idea that might help you along with those variables: you can always try to edit the MATLAB start script for Linux (not startup.m but the bash script returned by which matlab in your shell).

    这篇关于在Linux中更改MATLAB的启动文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆