Copy to an Array
Hi guys, I'm sure there is a simple way of doing this. But i want to copy to an array based on a variable. my example is I have an array called:
PERS num nPickOffsetX{8}:=[1,2,3,4,5,6, 0,0];
And a variable called:
VAR num nPatternNum:=0;
I want to copy into one of the two arrays below based on what number is is nPatternNum. So if it was 1 I copy into P1 if it's 2 I copy into P2
PERS num nPickOffsetX_LT0_P1{8}:=[0,0, 0,0,0,0,0,0];
PERS num nPickOffsetX_LT0_P2{8}:=[0,0, 0,0,0,0,0,0];
I realise I could use an "IF" function, however I want to be able to do this to an array size of about 150 of which there are 25 different variable in each array. So that is a lot of "IF"'s!
Any help would be appreciated?
0
Comments
-
What you are asking for is late binding. According to the RAPID Overview manual, late binding is only available for procedure calls.
An alternative to using IF would be CASE, unless you figure out a clever way to utilize late binding for procedure calls to solve your problem.
Henrik Berlin
ABB0 -
HiYou might be able to use the instruction called SetDataVal. Please see the Rapid Reference Manual, there is one example where SetDataVal is used with an array.-Osku0
-
Another option would be to add a dimension to the array and use the first field for indexing, instead of coding it into the name.Henrik Berlin
ABB0
Categories
- All Categories
- 5.5K RobotStudio
- 396 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 249 ScreenMaker
- 2.7K Robot Controller
- 310 IRC5
- 59 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 785 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 4 Job listings