Page 811 - ExtendSim User Guide
P. 811

Data Management and Exchange 785
Technologies for communication
2) UsetheCreateorOpenbuttoninthedialogsoftheReadandWriteblocks(Valuelibrary) when Text File is selected as the data type. This is useful if you want to create a file of data for use in a model. The Read and Write blocks are discussed on page 773
Working with text files
• The File > Import Data and File > Export Data commands are useful to exchange text file data from internal or external sources with dialog and plotter data tables or ExtendSim data- bases or global arrays. To see how these commands are used, see “Importing and exporting data” on page 734.
• The Read and Write blocks (Value library) provide an easy method for working with text files in a model. With these blocks text files can reside locally in the model or be remotely accessed over a network. These blocks also give added capability with text files in that they allow you to select which column and row of data to access. They are discussed in “Read and Write blocks” on page 773.
• When building custom blocks, use the file I/O functions described in the Developer Refer- ence to read and write text files.
How to create a text file
This example shows how to use menu commands to create a file with text and data:
Give the command File > New Text File.
In the Text File window, enter the information shown on the right into two tab-delimited columns. For example,
Type January
Click the tab key
Type 2.6
Click the enter or return key to start a new row
Continue entering the information, clicking the tab key after each month to separate the information into two columns and clicking the enter key after each value to start a new row of information.
Give the command File > Save Text File As and name the text file My Text.
☞ Because it is unformatted, the information in the text file will not be lined up as shown in the screen shot above. It is important that you do not try to line up the data by adding extra tabs as that will affect how the data is interpreted. There must be one, and only one, tab character sep- arating the columns.
Delimiting text file data
Columns in text files can be separated by a tab, a space, or a comma. Carriage return characters are always used to separate rows. When creating text files for use as inputs to ExtendSim blocks or other applications, consider how the blocks or programs want the data presented. For example, some ExtendSim blocks can take data columns separated a tab character, a space, or with another character such as a comma. On the other hand, Sensitivity Analysis and many external applications will only read files where the columns are delimited by tab characters. In general, it is best to use tab characters.
How To

   809   810   811   812   813