Head (before)

Set Multiple Variables to Values from Spreadsheet Using a For Loop — SIMUL8 Community Forum

Head (after)

Ask the SIMUL8 Community

Content (before)

Set Multiple Variables to Values from Spreadsheet Using a For Loop

byankelibyankeli
Created at
in Community support

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.



Tagged:

Comments

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Attach file
Attach image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file

Content (after)