Discussion Closed This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.
Application Builder, Newbie help, using For loop
Posted 2016年9月20日 GMT-4 04:24 Simulation Apps Version 5.2a 2 Replies
Please login with a confirmed email address before reporting spam
Hi
I have just started out using the API for the first time and I wish to generate a number of Global Parameters entries, namely sigma_ink1, sigma_ink2, sigma_ink3 etc.
I have successfully recorded a Method using the Set operation and surrounded it with a For block statement ...
int n=10;
for (int i=0; i<n; ++i) {
int j=i+1
with (model.param());
set("sigma_ink"+j, "1000[S/m]");
endwith();
}
but instead of using 'n' I want to use a defined Global parameter 'ArraySize' which = 10 (or whatever the user enters).
Question: What is the syntax for using ArraySize instead of 'n'?
I have tried...
for (int i=0; i<"ArraySize"; ++i)
...but this just gives an error and I have searched but not found an answer.
Any newbie help much appreciated
Colin
I have just started out using the API for the first time and I wish to generate a number of Global Parameters entries, namely sigma_ink1, sigma_ink2, sigma_ink3 etc.
I have successfully recorded a Method using the Set operation and surrounded it with a For block statement ...
int n=10;
for (int i=0; i<n; ++i) {
int j=i+1
with (model.param());
set("sigma_ink"+j, "1000[S/m]");
endwith();
}
but instead of using 'n' I want to use a defined Global parameter 'ArraySize' which = 10 (or whatever the user enters).
Question: What is the syntax for using ArraySize instead of 'n'?
I have tried...
for (int i=0; i<"ArraySize"; ++i)
...but this just gives an error and I have searched but not found an answer.
Any newbie help much appreciated
Colin
2 Replies Last Post 2016年9月20日 GMT-4 05:54