MATLAB ActiveX可选参数 [英] MATLAB ActiveX optional arguments

查看:78
本文介绍了MATLAB ActiveX可选参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一个ActiveX函数,我想从MATLAB调用它,例如

there is an ActiveX function, which I want to call from MATLAB, e.g.

PrintOut([Background], [Append], [Range], [OutputFileName], [From], [To], [Item], [Copies],
 [Pages], [PageType], [PrintToFile], [Collate], [FileName], [ActivePrinterMacGX],
 [ManualDuplexPrint], [PrintZoomColumn], [PrintZoomRow], [PrintZoomPaperWidth],
 [PrintZoomPaperHeight])

并按如下所示使用它:

hdlActiveX = actxserver('Word.Application');
hdlActiveX.PrintOut(opt args, needed args, opt opts, needed args);

PrintOut函数调用中的所有参数都是可选参数.但是,对于特定情况,我需要指定参数#3,#9,#10,并将所有其他参数保留为默认值.是否有可能在通过MATLAB调用的ActiveX函数调用中指定缺失值或默认值?

All arguments in the PrintOut function call are optional arguments. However, for a particular case, I need to specify argument #3,#9,#10 and to leave all other to default. Is there a possibility to specify missing or default values in an ActiveX function call invoked via MATLAB ?!?

在C#中可以这样做,但是在Matlab ActiveX中...?!?

In C# this could be done like this, but in Matlab ActiveX ... ?!?

this.PrintOut(ref Background, ref missing, ref Range, ref missing,
    ref missing, ref missing, ref missing, ref Copies,
    ref missing, ref PageType, ref PrintToFile, ref Collate,
    ref missing, ref ManualDuplexPrint, ref PrintZoomColumn,
    ref PrintZoomRow, ref missing, ref missing);

此致

推荐答案

根据Matlab文档,您可以跳过

According to the Matlab documentation, you can skip optional input arguments by using an empty array instead (i.e. []).

所以这看起来像:

hdlActiveX.PrintOut([],needed args,[],needed args);

这篇关于MATLAB ActiveX可选参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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