- MATLAB Engine API for Python: If you’re comfortable with Python, you could use the MATLAB Engine API to connect to a running MATLAB session from Python. You can share the MATLAB Engine session by typing matlab.engine.shareEngine in the first MATLAB session. Then, from Python, you can connect to this shared session and execute commands or scripts.
- MATLAB Automation Server: On Windows, you can start MATLAB with the '-automation' flag which allows you to attach an engine program to a MATLAB session that is already running. This could potentially be used to interact with the first session from the second one.
- File-based Communication: A more straightforward approach might be to use file-based communication. The first session could write the required information to a file, and the second session could read from this file. This method is less elegant but can be easier to implement.
Open a 2nd Matlab session and read model-file open in the 1st session (programatically)
3 ビュー (過去 30 日間)
古いコメントを表示
I have a unique situation where I need to programatically open a 2nd session of Matlab and run a script. That is easy enough. However, I need this script to check for some info in the 1st session. For example, return the current path in the first session, return a list of all the Simulink models open in the first session, maybe even rename some signals in one of the models in session 1. This I have no idea how to do.
I've read a bit about UDP, doesn't look like that would work for my use-case. Any suggestions welcome. Thanks.
J
0 件のコメント
回答 (1 件)
Animesh
2024 年 6 月 10 日
Interacting between two MATLAB sessions can be quite complex, but there are a few approaches you might consider:
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Startup and Shutdown についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!