read

Returns a vector from the specified data file.

Syntax

read(file_name, type, request, component)

Argument

file_name
The name of the file from which to read.
type
The type of data to read, either a string identifier as specified in the import template or external reader or the explicit numerical index.
request
The data request to read, either a string identifier as specified in the import template or external reader or the explicit numerical index.
component
The data component to read, either a string identifier as specified in the import template or external reader or the explicit numerical index.

Example

Templex Expression
{

a = read("two.xy", 0, 0, 0);

b = read("two.xy", 0, 0, 1);

table(a, b, "%8.2f %8.2f", 0, 5);

}

{

a = read("indy.req", 1, 0, 0);

b = read("indy.req", "Displacement", "REQ/997000 Global

CG movement", "X")

c = read("indy.req", 1, -997000, 0)

table(a, b, c, "%8.6f %8.6f %8.6f", 0, 25)

}

Comments

The resultant vector is read from the specified file using the appropriate import template or external reader in the MotionView or HyperGraph installation. Import templates and external readers contain the read instructions for the data file. Once these read instructions are registered with the software, all files of this type are automatically recognized by the software. Currently, there are over 40 different standard file types registered with the software. If a template or reader is not available, you can write a custom template and register it with the software describing the read instructions.

If you choose to use a string identifier for type, then you must use a string identifier for request and component. Similarly, if you choose to use an explicit numerical index for type, then request and component must be referenced with explicit numerical indices. Explicit numerical indices start at 0.

If the “Time” vector is explicitly defined in the import template or external reader, then type is automatically 0.

If a file is a MADYMO results file, request and component refer to the component and channel of the data, respectively.

If the file is an ADAMS request file, request and component refer to the request and component. In the ADAMS request file external reader, you have the option of specifying the ADAMS request ID number directly. To do this, specify type as one of the following:
Time
0
Displacement
1
Velocity
2
Acceleration
3
Force
4
User-defined
5

In addition, place a negative sign before the request ID. Use the explicit numerical index to access the components of the ADAMS request, for example: 0 = “X”, 1 = “Y”, 2 = “Z”. In the second example, the three read statements return the same vector of data; the X Displacement for ADAMS Request ID 997000.

If you don’t know the data string identifier for a data file, load the file into MotionView or HyperGraph using the Build Plots panel. The appropriate string identifiers are displayed for each of the type, request, and component fields. To identify the corresponding numerical index, plot the data and save the session script file. When writing the curve data information to the script file, MotionView and HyperGraph automatically write out the explicit numerical index.