Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add custom path and command when matlab kernel starts #36

Open
utotch opened this issue Jun 14, 2023 · 4 comments
Open

add custom path and command when matlab kernel starts #36

utotch opened this issue Jun 14, 2023 · 4 comments

Comments

@utotch
Copy link

utotch commented Jun 14, 2023

I tried to locate pathdef.m to notebook root or userpath of matlab but that doesn't affect to change path of the matlab kernel.

How can I automatically add custom path to a matlab kernel when the kernel starts?

@rashedmyt rashedmyt self-assigned this Jun 14, 2023
@rashedmyt rashedmyt added the question Further information is requested label Jun 15, 2023
@rashedmyt
Copy link
Member

Hi @utotch

I see that you want to add custom path and command automatically when the MATLAB Kernel starts.

You can modify the startup script to run the MATLAB commands which add custom paths and commands when MATLAB starts.

Hope this helps.

@rashedmyt rashedmyt added answered Issue has been answered waiting for response labels Jun 15, 2023
@utotch
Copy link
Author

utotch commented Jun 20, 2023

Thanks for the comment @rashedmyt.
I tried to add path in startup.m by using "addpath" function.
But unfortunately, the path was not added even though I reboot kernel and jupyterlab.

I think startup and pathdef loading spec is unclear and undocumented for Matlab kernel.

@prabhakk-mw prabhakk-mw removed waiting for response answered Issue has been answered labels Jul 3, 2023
@rashedmyt
Copy link
Member

Hi @utotch

Thank you for the response.

  1. Currently, we do not have an inbuilt solution to running custom commands on kernel start. I have notified the development teams of this feature, and we will consider this for a future release of the jupyter-matlab-proxy package.

    How can I automatically add custom path to a matlab kernel when the kernel starts?

  2. Please note that, when a kernel is starts up, it does not necessarily launch MATLAB. It may connect to an previously started MATLAB process. The architecture section of the README gives more information about the lifecycle of MATLAB and its relation to kernels.
    This information may help understand when the "MATLAB startup" scripts run wrt MATLAB kernels.

  3. Code executed from a notebook should behave the same way as it would have when run directly in MATLAB. I suspect there might be more going on with your particular environment.
    To help troubleshoot these issues related to the startup and pathdef would you please run this notebook and share the results?

@prabhakk-mw prabhakk-mw added feature request and removed question Further information is requested labels Sep 5, 2023
@prabhakk-mw
Copy link
Member

@utotch ,@rashedmyt

Does the environment variable MWI_MATLAB_STARTUP_SCRIPT from Advanced-Usage.md help this usecase?

@prabhakk-mw prabhakk-mw assigned prabhakk-mw and unassigned rashedmyt Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants