readsim
Returns a vector or matrix of values based on the channel name (string), not on the index. Indices will only be used for specifying the range of the returned vector.
Syntax
readsim(file_name, subcase, type, start_request, end_request, component_list,[start_idx], [end_idx])
Argument
- file_name
- The name of the results file from which to read (including full path).
- subcase
- The subcase for the data to be read, specified as a string. Acceptable values are the subcase string (for example, "Subcase 3"), or, if there is no subcase, an empty string ("") or "nosubcase".
- type
- The type of data to read, specified as the type string (for example, "Angular Acceleration").
- start_request
- The first data request to read, specified as a string. Acceptable values
are:
- The request string (for example, "Node 5").
- "firstrequest" for the first request in the request list.
- "lastrequest" for the last request in the request list.
- end_request
- The last data request to read, specified as a string. Acceptable values
are:
- The request string (for example, "Node 9").
- "firstrequest" for the first request in the request list.
- "lastrequest" for the last request in the request list.
- If there is only one element in the request list, an empty string ("") of "norequest".
- component_list
- The list of components, specified as strings. Acceptable values are the component string(s) from the components list. If only one component is given as the argument, no curly braces ("{}") are necessary (for example, "Res. ang. acc."); if more than one component is given, curly braces around each component name are required (for example, "{Res. ang. acc.} {X-comp*}".
- [start_value_idx]
- Optional argument. The integer of the zero-based value index. If specified, it will be the start index of the vector extracted from the full value list. A value of 0 corresponds to the first vector value, 1 corresponds to the second vector value, and so on. -1 corresponds to the last value, -2 to the second last, and so on. If this argument is not specified, the full vector will be returned.
- [end_timestep]
- Optional argument. The integer of the zero-based end time step index. A value of -1 corresponds to the last value, -2 to the second last, and so on. If this argument is given, all values between the start- and end-indices will be returned.
Example
{f = {getenv("ALTAIR_HOME")} + "/demos/mv_hv_hg/plotting/madymo/ANGACC"}
// The following statement returns the first 5 values of the time vector:
{readsim(f,"","Time","Time","Time","Time",0,4)}
// 0, 1, 2, 3, 4
// The following statement returns the full time vector:
{readsim(f,"","Time","Time","Time","Time")}
// 0, 1, 2, 3, …, 148, 149, 150
// The following statement returns the last value of the time vector of the specified channel:
{readsim(f,"","Angular Acceleration","50th% Hybrid3 - LOWER TORSO","50th% Hybrid3 - LOWER TORSO","Res. ang. acc.",-1,-1)}
// 133.543
// The following statement returns the last values for the specified channels:
{readsim(f,"","Angular Acceleration","50th% Hybrid3 - LOWER TORSO","50th% Hybrid3 - UPPER TORSO","Res. ang. acc.",-1,-1)}
// 133.543, 1052.18, 136.853
// The following statement returns the 3x5 matrix of the 5 last values for each of the 3 specified channels (the channels between “50th% Hybrid3 - LOWER TORSO" and "50th% Hybrid3 - UPPER TORSO" in the request list, inclusive:
{readsim(f,"","Angular Acceleration","50th% Hybrid3 - LOWER TORSO","50th% Hybrid3 - UPPER TORSO","Res. ang. acc.",-5,-1)}
// { 156.193, 152.723, 149.615, 142.193, 133.543 }, { 1147.29, 1124.6, 1099.29, 1093.22, 1052.18 }, { 157.844, 149.959, 147.201, 142.499, 136.853 }
Comments
All indices are zero-based.
This statement uses any available readers (import templates, external readers, or shared readers) to read the given data file.
The string arguments support the following wildcards: “*” for any number of characters, and “?” for one character.
If multiple matches are possible, an error message is returned to ensure that a unique value is given.
The resulting 2D matrix contains the same number of vectors as the first list given; all the vector values representing the second list are included in each element.