Contents Previous Next Subchapters

Transferring Data from Tecplot to O-Matrix
Syntax X = tpget(variable)
X = tpget(variablezone)
See Also tpput , tpget3D , tpopen , tpvarname , tpzonename , tpmacrostring , tpdims

Description
Transfers data from a Tecplot data set to O-Matrix. The current frame must contain a data set with data of type Double or Float. The argument variable must be an integer scalar or character row vector that specifies the variable number or variable name to retrieve. If present, the argument zone must be an integer scalar or character row vector that specifies the zone number or zone name to retrieve. If zone is not specified, data are retrieved from the first zone of the current data set. The returned value X is a double-precision valued matrix where the number of rows in X equals the I value of variable and the number of columns in X equals the J value of variable.

Examples

Retrieving Data from Tecplot
If you enter,
   clear
   tpopen
   x = {1.0,1,2,4,8}
   y1 = sqrt(x)
   tpplot(x,y1)
Tecplot will create an XY plot of x and y1. If you continue by entering
  y2 = tpget(2)
  y2' - y1'
O-Matrix will transfer the values of the second variable, (Y), in the current data set to the variable y2, and then print the difference between y1 and y2 illustrating that the values transferred are equivalent to those received.
 [ 0 , 0 , 0 , 0 , 0 ] 
Variables can also be retrieved by name, If you continue by entering
  y3 = tpget("Y")
  y3' - y1'
O-Matrix will echo the same result.

If you enter,
   clear
   tpopen([OM_INSTALL,"\example\tecplot\SixZones.lay"])
Tecplot will open the SixZones.lay sample file from the distribution which contains six zones named, Test One, Test Two, ... Test Six, with variables X, sine, and cosine. If you continue the example above by entering
   tpget("cosine", "Test Six")
O-Matrix will echo the value of the variable cosine in the zone name Test Six. The following script can be used to display, or retrieve all variables in all zones of the current data set.
   ix = 1
   while( tpzonename(ix) <> " ") begin
      jx = 1
      while( tpvarname(jx) <> " ") begin
         tpget(jx, ix)
         jx = jx + 1
      end
      ix = ix + 1
   end


The tpget and tpput functions can also be used to work with finite element data. If you enter,
  clear
  tpopen([OM_INSTALL,"\example\tecplot\DuctFlow.lay"])
  D = tpget("U(M/S)")
O-Matrix will retrieve the variable U(M/S) from the finite element sample file. If you continue by entering,
   sum( D > 250)
O-Matrix will echo
   3391
which is the number of values in the variable that are greater than 250.

Updating Results
Use of the tpget and tpput functions together is very powerful for updating data sets, either generated by O-Matrix or originally in Tecplot. If you enter,
   clear
   tpopen
   s = -pi:0.2:pi
   X = fillcols(s,rowdim(s))
   Y = fillrows(s',rowdim(s))
   M = sin(X) + cos(Y)
   tpsurface(M,X,Y)
Tecplot will generate the following surface plot,



If you continue, by entering
   ix = 1.0
   while( ix < 3.0 ) begin
      M = sin(X)*ix + cos(Y)*ix
      tpput(M,"Z")
      ix = ix + 0.1
      tpmacrostring("$!REDRAWALL")
   end
O-Matrix will update the value of Z created in the surface plot above and generate an animation that ends with the following image



If you enter,
   clear
   tpopen
   tpopen([OM_INSTALL,"\example\tecplot\rainfall.plt"])
   month = tpget("Month")
   dallas = tpget("Dallas Rainfall")
   seattle = tpget("Seattle Rainfall")
   tpframe("Seattle - Dallas Rainfall")
   tpplot(month, seattle - dallas)
O-Matrix will open, and transfer the Dallas and Seattle rainfall data values. A new frame will be created that plots the difference between Dallas and Seattle rainfall. If you want to change the Seattle rain data you can continue the example by entering,
   tpframe("Frame 001")
   tpput(seattle+1, "Seattle Rainfall")
and the plot will now look like