I would like to return the column that contains the lowest number in a specific row. How can i do that preferentially using the code editor inside the assign label?
I would like to return the column that contains the lowest number in a specific row. How can i do that preferentially using the code editor inside the assign label?
You can do this with a single for loop in the Value field of the Assign Labels activity:
Table table = Table("GlobalTable1"); int row = 1; int smallestColumn = 1; double smallestNumber = table[row][1]; for (int i = 2; i <= table.numCols; i++) { double curNumber = table[row][i]; if (curNumber < smallestNumber) { smallestNumber = curNumber; smallestColumn = i; } } return smallestColumn;
@Matthew Gillespie This was exactly what i needed! Thank you so much!
13 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