MATLAB ActiveX 可选参数
有一个 ActiveX 函数,我想从 MATLAB 调用它,例如
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 函数调用中指定缺失值或默认值?!?
在 C# 中可以这样完成,但在 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);
问候,
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])
and use it like follows :
hdlActiveX = actxserver('Word.Application');
hdlActiveX.PrintOut(opt args, needed args, opt opts, needed args);
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 ?!?
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);
Regards,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
根据Matlab文档,您可以跳过可选输入参数使用空数组代替(即
[]
)。所以这看起来像:
According to the Matlab documentation, you can skip optional input arguments by using an empty array instead (i.e.
[]
).So this would looks like:
我使用 NaN 作为默认/可选参数,它对我有用。所以我的版本是:
老实说,我认为两者都可以正常工作。希望这有帮助!
I use NaN for default/optional parameters and it works for me. So my version would be:
Honestly, I think both would work fine. Hope this helps!