LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW controlling Mathcad - SetValue problem

Solved!
Go to solution

How do I use SetValue ?

I am trying to control Mathcad from LabVIEW

I can open Mathcad, load a worksheet, use GetValue to read a value from Mathcad

I cannot seem to get SetValue to work

When I execute setValue, Mathcad complains that "This expression redefines a previously defined variable."

I enclose a zip file with mc test.vi and Test A plus b.xmcd

The Mathcad file calculates OutputC = InputA + InputB

Run the VI, it uses GetValue to get OutputC

Enable the Disabled Diagram structure to also SetValue InputA, rerun VI

Mathcad complains about redefinition of variable, LabVIEW GetValue throws: "The requested value was not found in the worksheet"

Beware: Do not save Mathcad file after running LabVIEW SetValue

Anyone know how to use SetValue ?

Where is the LabVIEW documentation for any of this.

I did find "Mathcad Help" (key F1) at section "External Files and Applications" -> "OLE Automation" and further in the text choose the reference on "Developer's Reference".

LabVIEW 2015, Mathcad Release 15 trial

Message 1 of 3
(2,219 Views)

Wow.  A MathCad user!  I was so sad to see MathSoft go belly-up and MathCad basically "die" at MathCad 15.  At the time of its release, I'd been a MathCad user for at least a decade, and it remains my favorite "M" software tool (MathCad, Matlab, Mathematica, Maple), though it's getting harder to install and use (I currently don't have it available on any of my current PCs-in-daily-use).  It is certainly the easiest and most intuitive tool for doing a simple (but complicated) calculation or function evaluation, and for doing (simple) symbolic manipulation (in my opinion).

 

By the time I got introduced to LabVIEW, I was using MathCad less (as it had morphed to MathCad Prime, with support, but "incomplete feature coverage" to MathCad 15).  I was using LabVIEW for my number-crunching, and never thought to try getting MathCad to do this, instead.  

 

I regret I don't currently have it installed -- I'd be interested in trying to duplicate and/or extend your findings.  Please continue to post replies to this thread as you (I hope) make progress.

 

Bob Schor

Message 2 of 3
(2,135 Views)
Solution
Accepted by topic author SteveE

Problem solved:
Do not assign a value to InputA in Mathcad, just type InputA := to declare the variable
When LabVIEW actions SetValue, the declaration line InputA := remains unchanged, but internally Mathcad assigns a value to InputA, hence the calculation completes and OutputC can be read back with GetValue.

 

Mathcad before LabVIEW run

SteveE_0-1588489929402.png

Mathcad after LabVIEW run

SteveE_1-1588490023210.png

Updated working copies of LabVIEW and Mathcad files attached.

 

0 Kudos
Message 3 of 3
(2,120 Views)