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 2 months 4 weeks ago #2051

  • CYSan1994
  • CYSan1994's Avatar
  • Offline
  • New Member
  • Posts: 12
  • 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: 2 months 4 weeks ago by CYSan1994.
The administrator has disabled public write access.

Array accessing issue 2 months 4 weeks ago #2052

  • fatkhrus
  • fatkhrus's Avatar
  • Offline
  • Administrator
  • Posts: 658
  • Thank you received: 101
  • Karma: -113
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