Welcome, Guest
Username: Password: Remember me
Welcome to TeslaSCADA forum!

Tell us and our members about your experience of using our products.

TOPIC: Array accessing issue

Array accessing issue 1 year 7 months ago #2051

  • CYSan1994
  • CYSan1994's Avatar
  • Offline
  • Junior Member
  • Posts: 28
  • Karma: 0
Hi,
How to assign array value in for loop?
below is the sample code. why the code always print twice
i_arr [1, 1]
i_arr [1, 1]

instead of

i_arr [1, 0]
i_arr [1, 1]

int i_arr[2];
Tags.mcnum = 2;
for (i=0;i < Tags.mcnum ; i++){
if(i_arr == 0) {
i_arr [ i ] = 1;
}
print(" i_arr " + i_arr);
}
Last Edit: 1 year 7 months ago by CYSan1994.
The administrator has disabled public write access.

Array accessing issue 1 year 7 months ago #2052

  • fatkhrus
  • fatkhrus's Avatar
  • Offline
  • Administrator
  • Posts: 826
  • Thank you received: 123
  • Karma: -107
Hello,

Our ST language doesn't support matrix. It supports only simple arrays like i_arr. Doesn't support i_arr[i,j].
To iterate you have to get every value of the element like in example: teslascada.com/HTML/using-tags-in-structured-text.html

Best regards,
Ruslan
The administrator has disabled public write access.
The following user(s) said Thank You: CYSan1994
Go to top