8.4. Importing Data

The ability to import data enables you to read in sets of data from a file into time-history variable(s). For example, you can display and compare test results data against the corresponding program results data.

Import data from a file into a time-history variable via one of the following methods:

  • Issue the DATA command to read in a pre-formatted file. The file should be in FORTRAN format (DATA).

  • Read the data from a free-format-, comma-, blank- or tab-delimited file. Store the data as a time-history variable by:

    1. Reading the file into a table array (*TREAD). This step requires that you know the number of data points in the file, as you must pre-specify the table array size ( *DIM ).

    2. Storing the array into a time-history variable (VPUT). You can store one array at a time into a time-history variable

  • The following two external commands (issued in the order shown) are available to facilitate importing data into time-history variables.

    1. ~eui,'ansys::results::timeHist::TREAD directorypath/filename arrayname'

      Determines the size of the data file, creates a table array of name 'arrayname', appropriately dimensions the array based on the number of data sets in the file, then reads the data into the array.

    2. ~eui,'ansys::results::timeHist::vputData arrayname variablenumber'

      Puts the data stored in the 'arrayname' table into the time-history variables, beginning with variable ID 'variable number'.

      For Example:

Example 8.8: Importing Data

~eui,'ansys::results::timeHist::TREAD  d:\test1\harmonic.prn TESTMID'
~eui,'ansys::results::timeHist::vputData TESTMID 5'

The first command reads data sets from the file harmonic.prn in the directory d:\test1 and stores this data in to the table array TESTMID.

The second command imports the data from TESTMID array into time-history variables beginning with variable number 5. If the harmonic.prn file contains multiple data sets, the first data set is stored in variable 5, the next data set in variable 6, and so on. If these variables have already been defined, they are overwritten.