In FlexSim 2017 we added a new Array type that holds Variants (a Variant can hold an int, double, string, treenode or Array). This allows you to store an Array as an element of another Array and, thus, make multi-dimensional arrays. There are a few ways you could do this:
Assign an array to another array element
Array myArray = Array(5); myArray[1] = [1, 2, 3];
Push an array onto another array
myArray.push(["Yes", 5, "No"]);
Fill the array with another array (The fill command puts the given value into every element of the array)
myArray.fill([1, 2, 3]);
Accessing Elements
Once you have a multi-dimensional array set up you use bracket notation to access individual elements.
int x = myArray[3][4]; // Gets the value of the 4th element in the array in the 3rd element of myArray. myArray[1][2][3] = 5; // Sets the value of the 3rd element in the array in the 2nd element of the array in the 1st element of myArray.
2 People are following this question.
FlexSim can help you understand and improve any system or process. Transform your existing data into accurate predictions.
FlexSim is a fully 3D simulation software environment. FlexSim can be used to simulate any process in any industry.
FlexSim®, FlexSim Healthcare™, Problem Solved.®, the FlexSim logo, the FlexSim X-mark, and the FlexSim Healthcare logo with stylized Caduceus mark are trademarks of FlexSim Software Products, Inc. All rights reserved.
Privacy | Do not sell or share my personal information | Cookie preferences | Report noncompliance | Terms of use | Legal | © Autodesk Inc. All rights reserved