Dumping TransCAD Matrices to OMX
I ended up in a position where I needed to dump a bunch of TransCAD matrix files to OMX files. This is a useful little script that scans all the matrices in a folder (presuming they use the .mtx file extension) and write them out as matrices.
Macro "convertMtx"(Args) base_folder = "C:\\your\\path\\here" di = GetDirectoryInfo(base_folder + "\\" + folders[fi] + "\\*.mtx", "File") for i = 1 to di.length do m = OpenMatrix(base_folder + "\\" + folders[fi] + "\\" + di[i][1], ) matrix_info = GetMatrixInfo(m) parts = SplitPath(base_folder + "\\" + folders[fi] + "\\" + di[i][1]) omx_filename = parts[1] + parts[2] + parts[3] + ".omx" mc = CreateMatrixCurrency(m,matrix_info[6].Tables[1],,, ) new_mat = CopyMatrix(mc, {{"File Name", omx_filename},{"OMX", "True"}}) end endMacro
I’m not sure if there is a better way to do this, but this works well enough once compiled and run in TransCAD 9.