LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with Mathscript in labview 7.1

Hi,
 
I wonder if anyone can explain to me why if I program inputs directly into a Mathscript node (e.g. a=1) the algorithm will run fine and output the results to a numeric indicator, but if I wire the inputs from a numeric control to the Mathscript node the algorithm outputs are incorrect (0).
 
I need to program it the first way as the input values will change depending on user input. I have attached a VI to illustrate my problem.
 
Many thanks to anyone who can solve this (probably very simple!) problem for me
 
Cheers,
 
Ian
 
P.S. I am running Labview 7.1 and Matlab 7.1
0 Kudos
Message 1 of 5
(3,019 Views)

Hi,

Unfortunatly I don't have MatLab installed on my machine. I'm wondering if you have looked at the error out followed this through from the MatLab Script node on your block diagram? Have you consulted the help guide on how to use the structure?

Beginning in LabVIEW 5.1, the MATLAB script node was introduced into the LabVIEW programming environment. The MATLAB script node makes ActiveX calls to the MATLAB software from within LabVIEW. This requires that both MATLAB be installed on the same machine.

Beginning in LabVIEW 8.0, MathScipt was introduced. MathScript is an integrated part of LabVIEW that you can use to combine intuitive graphical dataflow programming with math-oriented textual programming. Interoperability is far easier with the latest release of LV.

Kurt
NI UK Applications Engineer.

0 Kudos
Message 2 of 5
(3,000 Views)

Hi Kurt,

Apologies - you are right when you say I am using the MATLAB® script node.

Thanks for your suggestions on how to solve the problem. The code runs fine directly in Matlab so I don't think that is the problem, and I have looked at the help guide for the structure.

I posted on the main Labview forum before I was aware the Mathscript forum existed, so I also have a thread on there now: http://forums.ni.com/ni/board/message?board.id=MathScript&message.id=131

Cheers for your help,

Ian

0 Kudos
Message 3 of 5
(2,982 Views)

Hi Ian,

Just to be clear and reduce confusion, I think you are referring to the MATLAB®  script node, right?

The MATLAB script node and the MathScript node are similar in how you work with them in LabVIEW, but are very different in terms of requirements and how they perform calculations in LabVIEW. Both are "script nodes"--they are graphical text-editor regions that you can add to your LabVIEW graphical programs. Another similarity is that both utilize m-file script syntax.

The MATLAB script node differs from MathScript node in that when the MATLAB script node executes, LabVIEW calls the MATLAB software to execute the m-file script. The MathScript node is a native part of LabVIEW and so does not need additional third-party software to compile and execute m-file scripts.

Please see http://www.ni.com/mathscript for more information about MathScript.

I tried out your test m-file scripts with the MathScript node in LabVIEW 8.20 and didn't see the problem.

MATLAB® is a registered trademark of The MathWorks, Inc. All other trademarks are the property of their respective owners.

Sam Shearman
0 Kudos
Message 4 of 5
(2,981 Views)
I am indeed referring to the MATLAB® script node.
 
GrantM over on the MathScript forum solved the issue I had with my original problem so I have proved that the MATLAB® script node does work fine on my computer.
 
However, with the actual problem I need to solve (see http://forums.ni.com/ni/board/message?board.id=MathScript&message.id=131 for the code and file) it no longer outputs the results.
 
Cheers for your help,
 
Ian
0 Kudos
Message 5 of 5
(2,976 Views)