首页 | 本学科首页   官方微博 | 高级检索  
     

Matlab COM Server的VC++程序调用
作者单位:北京航空航天大学机械工程及自动化学院,河北理工大学计算中心,北京航空制造工程研究所
摘    要:工程中往往需要VC++编写的程序进行大量的数学计算,如能在程序中使用Matlab的例程这些问题则能迅速解决。在Win-dows平台上Matlab提供了两个实现这一目标的接口——Matlab Engine和Automation Server,两者在本质上都基于COM技术。引擎库通过其输出函数对用户屏蔽了底层的COM细节,这大大方便了使用。而使用自动化服务器就要使用COM的自动化接口IDispatch,不过MFC库的COleDispatchDriver类已使这一过程大大简化了。两种方式的差别主要体现在参数传递和返回值处理上,如文中代码所示。无论哪种方法,都可以将具有强大工程计算能力的Matlab接入VC++程序,从而快捷方面地解决许多数值计算和图形输出问题。

关 键 词:Matlab外部接口  混合编程  VC++  COM  自动化

Program with Matlab COM Server in VC++
Authors:SHEN Zhi-juan  YANG Hei-lai  WANG Shu-fen  ZHANG Wei-min
Affiliation:SHEN Zhi-juan1,YANG Hei-lai1,WANG Shu-fen2,ZHANG Wei-min3
Abstract:Programs written in VC++ sometimes need to do calculation intensive jobs,which can be solved swiftly if some Matlab function can be called inside the program.Matlab provides two methods to achieve this:Engine Library and Automation Server,both of which are based on COM.Engine Library made the custom COM interface IEngine transparent to the Client through its export functions while MFC class COleDispatchDriver encapsulates the detail of interacton with the COM Automation interface IDispatch.The given code in this article shows differences of the two method come mainly from the parameter passing and result retrieving process.With either method,Matlab can be linked into the program and thus make the calculation and figure output tasks be achieved faster and easier.
Keywords:matlab external interface  hybrid programming  VC++  COM  automation
本文献已被 CNKI 等数据库收录!
设为首页 | 免责声明 | 关于勤云 | 加入收藏

Copyright©北京勤云科技发展有限公司  京ICP备09084417号