MATLAB系统命令“按Enter退出" [英] MATLAB System Command "Press Enter to Exit"

查看:798
本文介绍了MATLAB系统命令“按Enter退出"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试编写一个MATLAB脚本,该脚本将调用并运行一个外部程序,然后继续执行其他MATLAB命令.

I am trying to write a MATLAB script that would call and run an external program and then proceed with other MATLAB commands.

tic                       %Start stopwatch
system('MyProgram.exe')   %Call and run my program
toc                       %End stopwatch 

但是,此程序"MyProgram.exe"要求我按Enter退出".如何使我的MATLAB脚本通过"Enter"继续?像如何在执行结束时将"Enter"作为程序的输入传递?还是一般来说该怎么做?

However, this program "MyProgram.exe" requires me to "Press Enter to Exit." How to make my MATLAB script pass "Enter" to proceed? Like How to pass "Enter" as an input of my program at the end of execution? Or how to do this in general ?

推荐答案

UNIX 上,您可以使用

system('MyProgram < /dev/null'). 

根据 Matlab文档中的建议:

要禁用标准输入和预输入重定向,请包含格式化的 在调用的命令的调用中输入文本< /dev/null.

To disable stdin and type-ahead redirection, include the formatted text < /dev/null in the call to the invoked command.

等效于 Windows (基于 查看全文

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