Macro Language: Assigning individual values to an array

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Macro Language: Assigning individual values to an array

Rick Simmons
Hello all,

Is there a way to assign values to an array from within a loop?

 

//For example: assume that I have 6 equal length arrays (y1 ... y6)

 

for (i=1; i<y1.length; i++) {

     sumY = y1[i] + y2[i] + y3[i] + y4[i] + y5[i] + y6[i];

     sumArray[i] = sumY;  //<<< of course, this does not work - is there
another way????

}

 


---------------------------------------------------------------------------------------------------------
This e-mail message may contain privileged and/or confidential information, and is intended to be received only by persons entitled to receive such information. If you have received this e-mail in error, please notify the sender immediately. Please delete it and all attachments from any servers, hard drives or any other media. Other use of this e-mail by you is strictly prohibited.


All e-mails and attachments sent and received are subject to monitoring, reading and archival by Monsanto, including its subsidiaries. The recipient of this e-mail is solely responsible for checking for the presence of "Viruses" or other "Malware". Monsanto, along with its subsidiaries, accepts no liability for any damage caused by any such code transmitted by or accompanying this e-mail or any attachment.
---------------------------------------------------------------------------------------------------------
Oky
Reply | Threaded
Open this post in threaded view
|

Re: Macro Language: Assigning individual values to an array

Oky
Hello,

You might just need to add the following before the for loop.

sumArray = newArray(y1.length);

Best regards,
Ohkyung

On Tue, Jun 22, 2010 at 12:41 PM, SIMMONS, RICK L [AG/1850]
<[hidden email]> wrote:

> Hello all,
>
> Is there a way to assign values to an array from within a loop?
>
> //For example: assume that I have 6 equal length arrays (y1 ... y6)
>
> for (i=1; i<y1.length; i++) {
>
>     sumY = y1[i] + y2[i] + y3[i] + y4[i] + y5[i] + y6[i];
>
>     sumArray[i] = sumY;  //<<< of course, this does not work - is there
> another way????
>
> }
>
>
>
>
> ---------------------------------------------------------------------------------------------------------
> This e-mail message may contain privileged and/or confidential information, and is intended to be received only by persons entitled to receive such information. If you have received this e-mail in error, please notify the sender immediately. Please delete it and all attachments from any servers, hard drives or any other media. Other use of this e-mail by you is strictly prohibited.
>
>
> All e-mails and attachments sent and received are subject to monitoring, reading and archival by Monsanto, including its subsidiaries. The recipient of this e-mail is solely responsible for checking for the presence of "Viruses" or other "Malware". Monsanto, along with its subsidiaries, accepts no liability for any damage caused by any such code transmitted by or accompanying this e-mail or any attachment.
> ---------------------------------------------------------------------------------------------------------
>



--
Ohkyung Kwon

http://www.linkedin.com/in/ohkyung
http://www.wpskorea.org
http://ncmir.ucsd.edu