Sign in to follow this  
Followers 0
Famous_Fella

Copy array element to member of a structure

3 posts in this topic

Posted (edited)

Hello,

In my ladder program I have 7 different arrays (containing REAL values) all members of a structure and I wish to extract certain values from the arrays and put them on another structure consisting of REAL values (not arrays). Which is the best way to do that ? I tried AryMove command but I get an error "Conversion from REAL to ANY_ELEMENTARY[], ENUM[], STRUCT[] is impossible. To get a better understanding of my structures and arrays here is an example:

Struct wheel_data
Global variable SWheel of wheel_data
rad[1...10] of real, vary[1...10] of real, varx[1...10] of real

struct. 2 wheel
Global variable Wheel1, .... , wheel10 of wheel

rad REAL, vary REAL, varx REAL



what I wish to do is to copy
Swheel.rad[1]  to wheel1.rad, 
Swheel.vary[1] to wheel1.vary,
Swheel.varx[1] to wheel1.varx

2nd structure
Swheel.rad[2]  to wheel2.rad, 
Swheel.vary[2] to wheel2.vary,
Swheel.varx[2] to wheel2.varx

until I fill all 10 wheel structure instances with values

Thanks in advance.

Edited by Famous_Fella

Share this post


Link to post
Share on other sites

You mean like this:

sWheels.jpg.988159434b6a00ee0345d9608727

I only did 3, but you get the point.

 

Here is my structure:

5e8746ce895b7_swheelstruct.jpg.157ad2298

Here are my variables:

5e8746ce3ccad_swheelglobal.jpg.b8ae3d930

Share this post


Link to post
Share on other sites
On 3/4/2020 at 5:21 PM, Michael Walsh said:

You mean like this:

sWheels.jpg.988159434b6a00ee0345d9608727

I only did 3, but you get the point.

 

Here is my structure:

5e8746ce895b7_swheelstruct.jpg.157ad2298

Here are my variables:

5e8746ce3ccad_swheelglobal.jpg.b8ae3d930

Thanks a lot for your help. I thought it was prohibited to use MOVE for Array data type so I didnt even try it. It works as intended.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0