加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

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

(2014-01-03 10:24:39)

转载于:http://digital.ni.com/public.nsf/allkb/14E6EF1812FF116548257257001E9EB1

 

主要软件: LabVIEW Development Systems>>LabVIEW Base Package
主要软件版本: N/A
主要软件修正版本: N/A
次要软件: N/A

http://digital.ni.com/images/global/us/invis.gif

问题:
当我在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 System
Primary Software Version: 6.0.2
Primary Software Fixed Version: N/A
Secondary Software: N/A
http://digital.ni.com/images/global/us/invis.gif

Problem:
I get Error 1047  in LabVIEW when I try to use the script node to interact with The MathWorks, Inc. MATLAB® software. I have properly installed versions of LabVIEW and the MATLAB® software and have run them both in the past, but I cannot get them to communicate with each other. What causes this error and how do I resolve it?

Solution:
This error occurs because ActiveX script server did not start properly. Consider the following possible solutions:
  1. 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.

  2. 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:

    1. Navigate to the MATLAB\(version)\bin directory (e.g. MATLAB\R2008b\bin).
    2. Enter matlab -regserver at the prompt and hit Enter.
    3. Quit the instance of the MATLAB® software that appears.
    4. The MATLAB script node should now be functional. (You may need to restart LabVIEW).
  3. If this does not work try installing the MATLAB® software locally and setting environment variable MATLAB_RESERVE_LO=0.

  4. 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?
MATLAB® is a registered trademark of The MathWorks, Inc. Other product and company names listed are trademarks and trade names of their respective companies.

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


0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有