Use of arrays as parameters and as RECORD elements
Hi,
I'm looking to do some fairly extensive manipulation of arrays in RAPID, and it would be a whole lot tidier if I could do things such as:
Passing an array as a parameter to a Proc/Func;
Declare an array as part of a RECORD or
Redimension an existing array, i.e. change its size.
Can't find anything in the RAPID manual on the subject, and running possible syntax through the syntax checker has only given negative results.
Any thoughts?
I'm looking to do some fairly extensive manipulation of arrays in RAPID, and it would be a whole lot tidier if I could do things such as:
Passing an array as a parameter to a Proc/Func;
Declare an array as part of a RECORD or
Redimension an existing array, i.e. change its size.
Can't find anything in the RAPID manual on the subject, and running possible syntax through the syntax checker has only given negative results.
Any thoughts?
Andrew
0
Comments
-
Passing an array as a parameter to a Proc/Func;Yes you can do this:PROC myTest(num myNum{*})!do somethingENDPROCDeclare an array as part of a RECORDNo, but the record can consist of other record types that could represent an array-like type:RECORD comp1num n1;num n2;num n3;ENDRECORDRECORD myReccomp1 c1;bool bBool;ENDRECORDYou could probably come up with some method using late-binding to fill in the elements of comp1 using a loop.
Redimension an existing array, i.e. change its size.I don't think this is possible
Russell Drown0 -
Thanks for that - the paragraph on sending a parameter looks useful, I hadn't tried putting a star in the curly brackets!
One more thing - can I use an array as a return value from a func?
Andrew0 -
Unfortunately, this is not possible, as described in section 5.4 of the RAPID Kernel reference:
Functions can have (return) any value data type (including any available installed type). A function cannot be dimensioned, i.e. a function cannot return an array value.Russell Drown0 -
[QUOTE=Cypherspaceman]One more thing - can I use an array as a return value from a func?
[/QUOTE]You can pass the array as an INOUT parameter to the func. That way you can still modify it.
0
Categories
- All Categories
- 5.5K RobotStudio
- 397 UpFeed
- 18 Tutorials
- 13 RobotApps
- 299 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 250 ScreenMaker
- 2.8K Robot Controller
- 319 IRC5
- 63 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 804 RAPID Programming
- 4 AppStudio
- 3 RobotStudio AR Viewer
- 19 Wizard Easy Programming
- 105 Collaborative Robots
- 5 Job listings