如何从命令行多次调用MATLAB,每次都使用相同的MATLAB实例 [英] How to call MATLAB from the command line several times, using the same MATLAB instance every time

查看:166
本文介绍了如何从命令行多次调用MATLAB,每次都使用相同的MATLAB实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个.m脚本,该脚本是从Windows命令行(又称提示符或提示符)调用的,并且每天用不同的参数调用此脚本几次(50 +).

I have a .m script that is called from the Windows command line (aka or prompt), and I call this script with different arguments several times (50+) a day.

我尝试使用matlab -r "run script.m"并且脚本已正确执行,但是每次我发出此提示命令时,都会打开一个新的MATLAB实例,在这种情况下,这是不可取的.

I tried using the matlab -r "run script.m" and the script is correctly executed, but everytime I issue this prompt command a new instance of MATLAB is opened, which is undesirable in this case.

是否有一种方法可以识别Windows 7计算机上已经在运行MATLAB的实例,并通过Windows命令行在多个外部调用上强制使用同一MATLAB实例?

Is there a way of identifying that there is an instance of MATLAB already running on my Windows 7 machine, and force the use of the same MATLAB instance on several external calls via Windows command line?

推荐答案

如所讨论的

As discussed here, you cannot prevent MATLAB from creating a window when starting on Windows systems, however, you can force the window to be hidden, by using the start command with the -nodesktop and -minimize options together:

start matlab -nosplash -nodesktop -minimize -r "run script.m"

或者简单地

start matlab -nosplash -nodesktop -minimize -r script

PS:尽管这将阻止创建新的MATLAB实例(完整的IDE),但仍将创建相同数量的MATLAB命令窗口(MATLAB进程).

PS: Although this will prevent creating new instances of MATLAB (full IDE), this still will create the same number of MATLAB command windows (MATLAB processes) instead.

这篇关于如何从命令行多次调用MATLAB,每次都使用相同的MATLAB实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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