Bringing data from a file into the ANSYS program for use in arrays or tables can lead to substantial time savings. The two primary commands to transfer data from an external file into an ANSYS parameter are *VREAD and *TREAD. *VREAD usually applies to arrays and *TREAD is for tabular data. However, the external file may not have the data formatted in the corresponding manner. *VREAD is restricted to fixed format while *TREAD can handle comma or tab delimited data. Prior to using either command you need to issue a *DIM command to set the type and size of the array or table.
Starting with a data file that has 10 rows and 3 columns of numeric values and that has no header and is named rawdata.txt (or .csv).
CASE 1) fixed format of F8.3 into an array
*DIM,ARR1,array,10,3
*VREAD,ARR1(1,1),rawdata,txt,,JIK,3,10
(3F8.3)
CASE 2) CSV format into a table – as a 2d table will always start with row and column 0 both of the row and column dimensions are reduced by 1
*DIM,TAB1,table,9,2
*TREAD,TAB1,rawdata,csv
CASE 3) CSV format of 3 or more columns into an array – cannot be read directly using *VREAD so read into a table and copy the values to the array
*DIM,TAB2,table,9,2
*TREAD,TAB2,rawdata,csv
*DIM,ARR2,array,10,3
*MFUN,ARR2(1,1),copy,TAB2(0,0)
*DEL,TAB2(1)
CASE 4) For a data file of 10 rows and only 2 columns in CSV format:
(special handling needed as a one dimensional table does not have any row 0)
*DIM,TAB3,table,10
*TREAD,TAB3,rawdata,csv
*DIM,ARR3,array,10,2
*MFUN,ARR3(1,1),copy,TAB3(1,0)
*DEL,TAB3(1)
The *STATUS command can be used to list the parameter contents but be aware that the minimum defaults to 1 so to list the table indexes you need to put 0 in for the minimum. Interactively, you could also use the array editor in the GUI but it does not show the contents at the 0,0 location.
I hope that helps deliver some time savings.
At times I find that I will know how many columns of data I have, but will not know before hand exactly how many rows. I find *SREAD useful here as it will auto *DIM itself when used to read in the file as a string array. The number of rows can then be retrieved with *GET and that used to *DIM the table/array for the *TREAD or *VREAD command.
Mike
You might also comment on using *VPLOT with an Array, and with a Table. An Array produces a bar graph, while a Table provides a line graph. Moving data from an Array to a Table with a *MFUN command, adjusting column location because of the 0_th column in a Table, can let users view line graphs of their array data.
The line graphs can be important checks that data was read correctly by *VREAD and by *TREAD, and make the graphs available for appendices in a report.