将文件添加到文件夹时运行 MATLAB 例程
我目前正在开发一个项目,其中一个或多个文件可以转储到服务器上的多个位置之一。我在 MATLAB 中设置了一个例程,可以很好地处理文件,我希望将其自动化,这样我就不必再浪费时间处理文件了。
我找到了一个 WMI 脚本(来自 ScriptingGuy Here) 的行为方式对我有用,但我对 WMI 不太了解改变它以达到我的目的。
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\cimv2")
Set colMonitoredEvents = objWMIService.ExecNotificationQuery _
("SELECT * FROM __InstanceCreationEvent WITHIN 10 WHERE " _
& "Targetinstance ISA 'CIM_DirectoryContainsFile' and " _
& "TargetInstance.GroupComponent= " _
& "'Win32_Directory.Name=""c:\\\\scripts""'")
Do
Set objLatestEvent = colMonitoredEvents.NextEvent
Wscript.Echo objLatestEvent.TargetInstance.PartComponent
Loop
我尝试使用 MATLAB 命令行工具替换 Wscript.Echo 行,
matlab -automation -r someRoutine(varargin)
但失败了。
有人可以给我一些关于从 WMI 正确调用 MATLAB 并将目标目录更改为服务器上的多个目录的指导吗?
I am currently working on a project where a file, or files, could be dumped to one of several locations on a server. I have a routine set up in MATLAB which processes the files quite nicely and I would like to automate this so that I don't have to waste any more of my time processing the files.
I found a WMI script (from ScriptingGuy Here) that behaves in a way that works for me, except I don't know enough about WMI to alter it to my purposes.
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\cimv2")
Set colMonitoredEvents = objWMIService.ExecNotificationQuery _
("SELECT * FROM __InstanceCreationEvent WITHIN 10 WHERE " _
& "Targetinstance ISA 'CIM_DirectoryContainsFile' and " _
& "TargetInstance.GroupComponent= " _
& "'Win32_Directory.Name=""c:\\\\scripts""'")
Do
Set objLatestEvent = colMonitoredEvents.NextEvent
Wscript.Echo objLatestEvent.TargetInstance.PartComponent
Loop
I tried using the command line tools for MATLAB replacing the Wscript.Echo line
matlab -automation -r someRoutine(varargin)
which failed miserably.
Could someone please give me some guidance on properly calling MATLAB from WMI and changing the target directory to multiple directories on the server?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您正在寻找
WScript.Shell
和Run
方法:文档描述了可选参数,这些参数允许您控制创建的进程的显示方式,以及是否等待它完成。
You are looking for
WScript.Shell
and theRun
method:The documentation describes optional parameters that allow you to control how the process that is created is shown, and whether or not you wait for it to complete.