![]() | |||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||
Reading 3-dimensional arrays Description This example shows how to read a 3-dimensional array from an excel file (threedimarr.mos) and from a generic spreadsheet (threedimarr5.mos). Model versions (2) and (4) show the same example for databases, and model version (6) works with data in CSV format.
Source Files By clicking on a file name, a preview is opened at the bottom of this page.
Data Files
threedimarr6.mos (!******************************************************* Mosel Example Problems ====================== file threedimarr6.mos ````````````````````` Reading 3-dimensional arrays. - Using 'initializations from' with the csv driver - (c) 2012 Fair Isaac Corporation author: S. Heipcke, Dec. 2012, rev. Apr. 2014 *******************************************************!) model "ThreeDimArr (CSV)" uses "mmsheet" parameters CSTR= 'mmsheet.csv:threedim.csv' end-parameters declarations I: range J: set of string K = 1..5 ! The last index set must be defined in the model A: dynamic array(I,J,K) of real end-declarations initializations from CSTR A as 'partndx;[A3:G8]' end-initializations writeln("A: ") forall(i in I, j in J, k in K | exists(A(i,j,k))) writeln("A(", i, ",", j, ",", k, "): ", A(i,j,k)) end-model
| |||||||||||||||||||||||||||||||
© Copyright 2023 Fair Isaac Corporation. |