How to deal with arrays ?
-
Hello,
I have questions about arrays to pass to ST programs and FBD programs.- how to declare arrays on MervisIDE, such as MyVariables ARRAY[0..10] on INT ? I do not see any array related type in pull downs.
- according to my case, Mervis has specific array type of int, MultiIoInt data type. Are you supposed me to use this type when I want use array of integer ?
thank you.
-
Hello @ayone0518,
- You almost got it right. The definition is this:
VAR my_array: ARRAY[0..10] OF INT; my_prefilled_array: ARRAY[0..2] OF REAL := [ 1.123, 2.345, 3.456 ]; END_VAR
- Since this is the first time I hear of this then no, use the standard ST definition :-)
Best regards,
Martin -
Thank you Martin.
I have one more question.
Can I declare array as local variable on Mervis FBD UI ?
It seems I can't do this on it. -
Hello @ayone0518,
no, the arrays cannot be defined in FBD.Best regards,
Martin