Download User Guide

Transcript
4 Programming Mathematica Link for LabVIEW
the same computer, and that the protocol used is the default local
protocol.
Open the link in Mathematica.
In[1]:=
link = LinkOpen["5678", LinkMode->Listen]
Out[1]=
LinkObject[5678, 2, 2]
In[2]:=
LinkConnect[link]
Out[2]=
LinkObject[5678, 2, 2]
In LabVIEW, run MathLink Temperature.vi. The connection
establishes itself automatically. The function of the VI is to return the
most recent temperature history to Mathematica upon request.
Now, let us define the function used to query LabVIEW for the data.
Our query will be composed of three parts: First, it is necessary to send a
short message to say that we want the data. Second, we need to read
the link. Finally, we want to plot the data. All three objectives can be
met like this:
In[3]:=
ReadChart[link_] := (LinkWrite[link, "top"];
ListPlot[LinkRead[link],
Frame->True, Axes->False, PlotLabel>"TemperatureHistory"])
108