We have been shortlisted! We are delighted to be nominated for 5 Tech for Good awards for our work with South African charity Shout It Now. Read more here.
Multi Dimensional Arrays
<!– CONTEXTID_379 –>
Multi Dimensional Arrays are a type of Global Data Item found in the Information Store.
A Simul8 Spreadsheet is an example of a 2 dimensional array: dimension 1 is the columns and dimension 2 is the rows.
Create an array using the Information Store.
Enter the dimensions of the array in by entering the number of dimension and the size of each dimension in the Dimensions text box.
Example 1: A 2 dimensional array (a spreadsheet) with 10 rows and 5 columns enter 5,10 as the dimension of the array.
Example 2: A 3 dimensional array (a cube) with 10 rows, 5 columns and 6 layers enter 6,5,10 as the dimension of the array.
Example 3: A 4 dimensional array (a number of identically sized cubes) with 3 cubes each with 10 rows, 5 columns and 6 layers would be dimensioned as 3,6,5,10
To change the values in an array click the View button on properties dialog of the array. Only 2 dimensions of an array can be displayed (like a spreadsheet). Select the dimension to view and type the new values into the appropriate cell.
Values within an array can be set using the Visual Logic SET Command. For example SET ra_CycleTimes[1,1,1,1] = 10 where ra_Times is a 4 dimensional array.
There are a number of Visual Logic commands that have been introduced to operate with arrays:
- Redimension Array: changes array dimension sizes and number of dimensions
- Redimension Array and Clear: empties an array changes dimension sizes and number of dimensions
- Clear Array: empty an array
Get_Trial_Run_Number_with_MDA.s8 This example shows how to record results from each trial run to the respective sheet in a Multi-Dimensional Array