Content (before)
Set Multiple Variables to Values from Spreadsheet Using a For Loop
I am pulling in values for variables from Excel and placing them into a spreadsheet within my Simul8 model. When I am trying to set variables within the system (i.e. times and probability distributions) I have not found a way to set these values all at once within a loop. Instead I am writing one line for each variable that needs to be set in the form of, where 5 is the fifth column in my Var1 spreadsheet :
Set Prob-Profile Distrib Column dist_ProductType , 1 , 1 , Var1[5,1]
Set Prob-Profile Distrib Column dist_ProductType , 2 , 2 , Var1[5,2]
Is there a way to write a loop so that does not have to be repeated tons of times in the form of:
for i=1:n
Set Prob-Profile Distrib Column dist_ProductType , i , i , Var1[5,i]
end
As I add more and more complexities to my models having to write multiple lines of codes to simply set a variables gets excessive.
Any help would be appreciated.
Comments
Was this answer helpful?
1
Hi there, you can use the LOOP command in Visual Logic, where you'll be able to set the number of iterations, i.e.
Loop 1 >>> i >>> [Number of iterations]
Here's the help for this: https://www.simul8.com/support/help/doku.php?id=features:visual_logic:commands:loop
Maksim