matlab启动.exe文件

最近对C++兴趣又来了,前几天又有留言问我这个问题,就正好来练练手吧。

用matlab做实验的时,有时候在matlab执行的过程中,要启动.exe程序,当然肯定不能指望用手动方式来启动,那么想要用matlab启动的话,要如何做呢?

#include<iostream>
using namespace std;
 
int main()
{
	int a = 1;
	int b = 2;
	int c = a + b;
	cout << c << endl;
 
	return 0;
}

设生成的.exe文件为test.exe,且把该文件放在桌面上,现在用matlab来启动test.exe,matlab程序如下:

clear
clc
cmd = 'C:\Documents and Settings\Administrator\桌面\test.exe';
system(cmd);

       结果为: 3

以上就是这样啦,不多说。

猜你喜欢

转载自blog.csdn.net/stpeace/article/details/120475955
今日推荐