# Addressing a single value in an array

**URL:** <https://tech-community.robotics.abb.com/t/addressing-a-single-value-in-an-array/2757>\
**Category:** RobotStudio\
**Created:** [May 13, 2009, 2:22am UTC](https://tech-community.robotics.abb.com/t/addressing-a-single-value-in-an-array/2757 "2009-05-13T02:22:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![gianluigi](https://avatars.discourse-cdn.com/v4/letter/g/a5b964/32.png) [@gianluigi](https://tech-community.robotics.abb.com/u/gianluigi)\
**Post date:** [May 13, 2009, 2:22am UTC](https://tech-community.robotics.abb.com/t/addressing-a-single-value-in-an-array/2757/1 "2009-05-13T02:22:39Z")

</div>

Hello all,

I’m trying to retrieve each individual joint angle from a jointtarget data, which is off the form:  
jpos:=[[-10, 80,-30, 20, 0, 0] , [9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];

How do I address these values to a variable? For instance I want to assign each of the joint angle data to different variables like;  
q1=-10;  
q2=80;  
q3=-30;  
q4=20;  
q5=0;  
q6=0.

Thank you,  
Gianluigi

---

<div class="post-metadata">

**Author:** ![BigM](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@BigM](https://tech-community.robotics.abb.com/u/BigM)\
**Post date:** [May 13, 2009, 6:47am UTC](https://tech-community.robotics.abb.com/t/addressing-a-single-value-in-an-array/2757/2 "2009-05-13T06:47:45Z")

</div>

Hi Gianluigi,  
To retrieve the elements from the jointtarget is not hard at all.  
We know the structure of a jointtarget is of the form;

\< dataobject of **jointtarget** \>  
\< **robax** of robjoint \>  
\< **rax\_1** of num \>  
\< **rax\_2** of num \>  
\< **rax\_3** of num \>  
\< **rax\_4** of num \>  
\< **rax\_5** of num \>  
\< **rax\_6** of num \>  
\< **extax** of extjoint \>

\< **eax\_a** of num \>  
\< **eax\_b** of num \>  
\< **eax\_c** of num \>  
\< **eax\_d** of num \>  
\< **eax\_e** of num \>  
\< **eax\_f** of num \>

Thus, to get the angles of robot axes from jPosCurrent…

PERS jointtarget jPosCurrent;  
PERS num J1;  
PERS num J2;  
PERS num J3;  
PERS num J4;  
PERS num J5;  
PERS num J6;

J1:=jPosCurrent.robax.rax\_1;  
J2:=jPosCurrent.robax.rax\_2;  
J3:=jPosCurrent.robax.rax\_3;  
J4:=jPosCurrent.robax.rax\_4;  
J5:=jPosCurrent.robax.rax\_5;  
J6:=jPosCurrent.robax.rax\_6;

Regards,

BigM

---

<div class="post-metadata">

**Author:** ![Klaus](https://avatars.discourse-cdn.com/v4/letter/k/e99b99/32.png) [@Klaus](https://tech-community.robotics.abb.com/u/Klaus)\
**Post date:** [May 13, 2009, 11:55am UTC](https://tech-community.robotics.abb.com/t/addressing-a-single-value-in-an-array/2757/3 "2009-05-13T11:55:39Z")

</div>

I remark.

If you use PERS remember to initilise value in decleration

PERS Num PERSNume := Value;

BR Klaus

---

<div class="post-metadata">

**Author:** ![gianluigi](https://avatars.discourse-cdn.com/v4/letter/g/a5b964/32.png) [@gianluigi](https://tech-community.robotics.abb.com/u/gianluigi)\
**Post date:** [May 13, 2009, 5:05pm UTC](https://tech-community.robotics.abb.com/t/addressing-a-single-value-in-an-array/2757/4 "2009-05-13T17:05:37Z")

</div>

Well, it was like rocket science to me :stuck_out_tongue:

Thank you so much BigM and Klaus!
