Product(s): | Cube |
Version(s): | 6.1 to 6.5 |
Area: | Matrix |
Matrix program is very flexible and powerful for data manipulation. In this example, we will show how to convert CSV files into MAT files and vice versa. You can use this sample catalog to practice different CSV formats. Just replace the input file with your own file and modify some of part of the scripts. The purpose of this example is to help users to understand how PATTERN and FIELDS with different file structures.
The input CSV file contains trips data of this example is shown below:
The structure of the input file is I, J, M, V1, V2. We have two tables in the input file. So the first line means that from zone 1 to zone 1. There are 10 trips for MODE1 and 100 trips for MODE2.
So first, we convert the above trip file into OD matrix, refer to Matrix program #1. The MAT file we get will looks below:
Next, we will convert the above MAT file back to CSV file with the original format. This will be done in Matrix program #2.
Last, we will read the MAT file and output CSV file with MATRIX format for table 1 (HOV) only in Matrix program #3. The output CSV file will be the following:
You can download the catalog of this example in the attachment. The figure below illustrates its application process.