从Matlab运行C程序的可执行文件并获取输出 [英] Running C program's executable from Matlab and getting the output

查看:110
本文介绍了从Matlab运行C程序的可执行文件并获取输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Visual Studio Express 2010中编译了一个C程序.

I compiled a C program in Visual Studio Express 2010.

#include<stdio.h>

main()
{
    printf("Hello World");

}

这将在我的C驱动器上生成文件"hello.exe".在Matlab中,我使用此命令,

This produces a file "hello.exe" on my C drive. In Matlab, I use this command,

! hello

它会在我的Matlab控制台上打印"Hello World".

And it prints "Hello World" to my Matlab console.

! Matlab命令的名称是什么?我一直在努力寻找有关它的文档,但是遇到了困难,因为我不知道Google要用什么关键字.谢谢!

What is the name of the ! Matlab command? I have been trying to find documentation for it but is having difficulty because I don't know what keywords to Google for. Thanks!

其他信息

我将运行一个相当复杂的C程序,该程序输出纯文本文件.然后使用Matlab读取文本文件,将数据放入矩阵/数组,然后在Matlab中进行处理.

I will be running a fairly complicated C program that outputs a plain text file. Then using Matlab to read the text file, put the data into matrices/arrays and manipulate these in Matlab.

推荐答案

您已经阅读了吗?

http://www.mathworks.se/help/symbolic/mupad_ref/system.html

我认为这就是您要寻找的=)

I think it's what you're looking for =)

此外,如果您输入:

help !

您将获得名称(以及其他名称):

You will get the name (amongst other stuff):

punct - Invoke operating system command - ! 

这篇关于从Matlab运行C程序的可执行文件并获取输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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