Reading data in from text files
- Read data into COST from cost.dat
-
initializations from 'cost.dat' COST end-initializations
- Data file cost.dat (dense data format)
-
COST : [3.9 0 4.8 0 7.5 5.5]
- Data file cost2.dat (sparse data format)
-
COST: [("Oil1" 1) 3.9 ("Oil1" 3) 4.8 ("Oil2" 2) 7.5 ("Oil2" 3) 5.5]
- Mosel data format:
-
- file may include single line comments, marked with '!'
- format: label, colon, data value(s)
- for an array, use a single list enclosed in [ ]
- list may be comma or space separated
- dense format: the values fill the data table starting at the first position and varying the last index most rapidly
- sparse format: each data item is preceded by the corresponding index tuple (in brackets)
- Specifying the absolute path
-
initializations from 'c:/data/cost.dat' COST end-initializations
- Path relative to current working directory
-
initializations from '../cost.dat' COST end-initializations
- Read several data tables from a single file
-
initializations from 'cost.dat' SCOST PCOST end-initializations
- Different data label and model object names
-
initializations from 'cost.dat' COST as 'COST_DETAILS' end-initializations
- Read several data arrays with identical index sets from a single table
-
initializations from 'chess.dat' [DUR,WOOD,PROFIT] as 'ChessData' end-initializations