当我在LabVIEW中使用MATLAB脚本节点的时候,为什么会遇到错误1047

转载于:http://digital.ni.com/public.nsf/allkb/14E6EF1812FF116548257257
主要软件: LabVIEW Development
Systems>>LabVIEW Base Package
主要软件版本: N/A
主要软件修正版本: N/A
次要软件: N/A
|
问题:
当我在LabVIEW中尝试使用MATLAB脚本节点去与MathWorks公司的MATLAB软件进行交互的时候,遇到错误1047。我已经正确安装了MATLAB和LabVIEW软件,并能运行它们,但我不能使它们相互进行通讯。
解答:
如果您已经安装好了MATLAB并至少运行过一次,那么所有的ActiveX组件都会在操作系统中进行注册。为了使用Script Server,请先关闭所有程序(MATLAB和LabVIEW),然后打开MATLAB,等MATLAB完全装载入内存之后,再启动LabVIEW。这时,Script Server应该有回应,错误也不会再出现了。
为了重新注册ActiveX组件,请在命令行界面中切换到
MATLAB\(version)\bin
目录(例如
MATLAB\R2006b\bin
) 并运行下面的命令:matlab -regserver
这时,MATLAB 脚本节点应该起作用了(您可能需要重启LabVIEW)。
如果您仍然遇到这个错误,那问题可能与读取输入的脚本语言相关,这些脚本使用 MathWorks, Inc. MATLAB 语言语法。如果是这样的话,请运行范例程序"Lorenze Diff Eq.vi"看问题是否仍然存在,该范例程序有变量输入到脚本。然而, 范例程序"Fractal.vi" 可能成功执行是因为它仅有脚本节点输出。把输入数据的类型改为复数形式是一个解决该问题的简单方法。为了永远解决这个问题,您应该安装知识库300A6NDT中的补丁程序,链接如下。
MATLAB® 是 MathWorks公司的注册商标。 其余列出的产品和公司名是其各自公司的商标名和商品名。
Why Do I Get Error 1047 When Trying to Use The MATLAB® Script Node in LabVIEW?
Primary Software: LabVIEW Development Systems>>LabVIEW Full Development SystemPrimary Software Version: 6.0.2
Primary Software Fixed Version: N/A
Secondary Software: N/A
|
Problem:
I get Error 1047
Solution:
This error occurs because ActiveX script server did not start properly. Consider the following possible solutions:
- If you have installed the MATLAB® software and have run it at
least once before, then all of the ActiveX components should be
registered with the operating system. In order to use the script
server, close out all programs (the MATLAB® software and LabVIEW).
Open the MATLAB® software and then open LabVIEW after the MATLAB®
software fully loads. The script server should now respond and the
error should no longer appear.
- In order to reregister the ActiveX components, open the Command
Prompt (Click Start»Run, type cmd in the Open field and click
OK) and do the following:
- Navigate to the
MATLAB\(version)\bin
directory (e.g.MATLAB\R2008b\bin
). Enter matlab -regserver
at the prompt and hit Enter.- Quit the instance of the MATLAB® software that appears.
- The MATLAB script node should now be functional. (You may need to restart LabVIEW).
- Navigate to the
- If this does not work try installing the MATLAB® software
locally and setting environment variable
MATLAB_RESERVE_LO=0.
- If you still get the same error, the problem might be with reading inputs to the script written in The MathWorks, Inc. MATLAB® language syntax. If this is the case, running the shipping example program Lorenz throws the same error, since it has inputs to the script. However, MathScript Fractal executes without errors, as it only uses outputs. Changing the Data Type of inputs and outputs to Complex will provide an easy fix to the problem. To solve the problem permanently, you should install the patch provided in KnowledgeBase 300A6NDT: How Can I Resolve MATLAB® script node and Xmath Script Node Issues in LabVIEW?
Related Links:
KnowledgeBase 300A6NDT: How Can I Resolve MATLAB® script node and Xmath Script Node Issues in LabVIEW?
KnowledgeBase 2C1AH6DM - LabVIEW 6.x and Earlier Does Not Interface Properly with The MathWorks, Inc. MATLAB® Software Version 6.1 or 6.5