File IO / FileReader
Block Name: FileReader
Code File Location: VisualSim/actor/lib/io/ExpressionReader
o Read from a file where the column value can have a different data type.
o Abstract part of the model by using the response or generation from another model.
This block accepts a file name as a parameter. There are a number of file path options available for this block. To see the list, view the section on File Paths in the Reference Guide document here. The file name is a concatenation of any number of individual strings and parameters, separated by "+". To view the file path in a demo model, click here.
This block reads a file or URL, one line at a time, evaluates each line as an expression, and outputs the token resulting from the evaluation. The first line in the file determines the data type of the output. All other lines must contain expressions that evaluate to the same type or a subtype, or a run-time type error will occur. This block will terminate at the end of the file.
This block loads one line at a time into memory before sending the output. If you are using table that have columns with headers, use the TrafficReader block.
If the file contains a data structure, the each line would look like this:
"{X = 1.0E-10, Y = 1}"
Notice the "" on the ends of each line. Also, any strings in the file must contain /" before and after the string.
If this Reader reads a file containing data structures that have been saved from another model, make sure the data has been formatted using "recordTokenToLineWriter(input)" RegEx function before written.
View the FileReader Example in the BDE.
Parameter |
Explanation |
fileOrURL |
The format is either http://www.mirabilisdesign.com/filename.txt (URL, file located anywhere on the Internet) or C:/VisualSim/filename.txt (Windows) or file://VisualSim/filename.txt (Unix/Linux). If the filename alone is listed, then the directory containing the model is assumed. The file name is a concatenation of any number of individual strings and parameters, separated by "+". |
Created with the Personal Edition of HelpNDoc: Generate Kindle eBooks with ease