AnsweredAssumed Answered

vrf Why doesn't this populate the array correctly?

Question asked by VRFuser on Sep 14, 2007
Thanks!

-----Original Message-----
From: Stan Bischof [mailto:rsb@soco.agilent.com]
Sent: Friday, September 14, 2007 1:40 PM
To: VRF
Cc: vrf@agilent.com
Subject: Re: [vrf] Why doesn't this populate the array correctly?

"Claflin, Carrie" <carrie.claflin@hp.com> wrote:
> I've attached to program.  Basically, I'm just trying to step through
> an array and put a number in the second column.  To make the example
> simple I've hard coded it to one.  In stead of walking through the
> array and filling the second column with 1s as it goes, it seems to
> zero the entire array and only put a one in that specific element. 
> During the next step the previous 1 is gone (0
> out) and the next element is set.
>
> Thanks in advance for any help.  I must be missing a basic concept.

"a" is a local variable inside of your formula. Each time the formula is run you reset "a" to whatever you input to the terminal, losing whatever changes you previously made.

What you want to do is to use a scoped variable for your array- perhaps a global or alternately use the formula's "a" output to set a global dynamically.

The former is suggested so that you formula looks something like

globalArray[index,1]=1

of course when you do this there's probably no reason to use a global for the index since you are passing it through a pin anyhow.

Basically-- use local variable ( like the loop index ) for the array index and global variable for the array--- the opposite of what you have.

Stan


--------------------------------------------------------------------------
Stan Bischof  Agilent Technologies  707-577-3994  stan_bischof@agilent.com
--------------------------------------------------------------------------

---
You are currently subscribed to vrf as: carrie.claflin@hp.com To subscribe please send an email to: "vrf-request@lists.it.agilent.com" with the word subscribe in the message body.
To unsubscribe send a blank email to "leave-vrf@it.lists.it.agilent.com".
To send messages to this mailing list,  email "vrf@agilent.com".
If you need help with the mailing list send a message to "owner-vrf@it.lists.it.agilent.com".
Search the "unofficial vrf archive" at "http://www.vrfarchive.com/vrf_archive".
Search the Agilent vrf archive at "http://vee.engineering.agilent.com".

---
You are currently subscribed to vrf as: ming_meng@agilent.com To subscribe please send an email to: "vrf-request@lists.it.agilent.com" with the word subscribe in the message body.
To unsubscribe send a blank email to "leave-vrf@it.lists.it.agilent.com".
To send messages to this mailing list,  email "vrf@agilent.com". 
If you need help with the mailing list send a message to "owner-vrf@it.lists.it.agilent.com".
Search the "unofficial vrf archive" at "http://www.vrfarchive.com/vrf_archive".
Search the Agilent vrf archive at "http://vee.engineering.agilent.com".

Outcomes