命名管道Matlab [英] Named Pipes Matlab

查看:79
本文介绍了命名管道Matlab的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在查找用于在matlab中创建名为pipe的窗口的示例时遇到麻烦.

I am having trouble locating an example for creating a windows named pipe in matlab.

关于程序设计或外观的任何建议吗?

Any suggestions on how to program or where to look?

推荐答案

使用.NET的 System.IO.Pipes 可能是开箱即用的最简单方法,比编写MEX文件调用Win32 API容易.Matlab使您可以直接从M代码调用.NET,并且可以管理对象,因此资源清除将更加容易..NET 3.5及更高版本支持命名管道.

Using .NET's System.IO.Pipes is probably the easiest way out of the box, easier than writing a MEX file to call the Win32 API. Matlab lets you call .NET directly from M-code, and the objects are managed so resource cleanup will be easier. .NET 3.5 and newer support named pipes.

生成的M代码看起来像这样.(抱歉;我目前没有Matlab,因此无法对其进行测试.)

The resulting M-code would look something like this. (Sorry; I don't have Matlab at the moment so can't test it.)

NET.addAssembly('System.Core'); %# might be superfluous
pipeStream = System.IO.Pipes.NamedPipeServerStream('testpipe', System.IO.Pipes.PipeDirection.Out);

如今,我认为.NET是访问Matlab未直接公开的Windows本机功能的最简单方法.因此,对于这样的事情,首先要尝试的是寻找在C#中执行此操作的示例.如果可以使用.NET标准库功能在C#中完成,则通常可以将其直接转换为M代码.例如.我通过Google搜索创建命名管道.net"并获取此示例.洛伦此处.

Nowadays, I think .NET is the easiest way to access native Windows features that Matlab doesn't directly expose. So for something like this, the first thing to try is looking for examples of doing it in C#. If it can be done in C# using .NET standard library features, you can often translate it pretty directly to M-code. E.g. I found this one by Googling for "create named pipe .net" and getting this example. Loren discusses this technique here.

这篇关于命名管道Matlab的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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