- 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!