LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to change a value in an array ?

hi every body i'am writing cause I don't understand something. i have a big 2D array and two 1D array. the two 1D array are lists of coordonate in the big D array X and Y. I want to put a 1 value in the big 2D array each time the coordonate is in the d arrays.

that's what i did. Seems perfectly good to me but doesn't work at all. could you tell me why ? thanks

 

0 Kudos
Message 1 of 8
(5,015 Views)

How are you updating the values in the array. I see you are using a local variable of an array and you are replacing the value into another array since you are always reading from the same array your local variable array will not get updated. You need to use shift register for this purpose.

 

 Replace 2 D Array.PNG

Good luck

 

-----

The best solution is the one you find it by yourself
0 Kudos
Message 2 of 8
(5,005 Views)

That example you provided has two problems:

  • Why are you using a local variable of the control to feed the shift register, when the control is right there?
  • Do NOT auto-index a for-loop and wire a contant to the N terminal at the same time.

As for the original code: I don't know what the rest of the code looks like, but if what you show is the whole thing, you need to stop using local variables so freely. I'm guessing you come from a text-based background. Local variables are not meant to be used for data storage. They are not the same as local variables in text-based languages. I have NO idea why NI decided to use that name, as it was a big mistake.

0 Kudos
Message 3 of 8
(4,992 Views)

I just wanted the OP to understand but I agree that I shouldn't have done. Yes about the Auto indexing I workd out after posting it and I should have given a suggestion not to do it.

-----

The best solution is the one you find it by yourself
0 Kudos
Message 4 of 8
(4,986 Views)

Hi,

 

Replace Array Element.png

 

Best Regards,

Luis A. Mata C.
Ing. Electrónico
Whatsapp: +58-414-1985579
BBM Pin: 2B83E99A
Thanks: Kudos
0 Kudos
Message 5 of 8
(4,968 Views)

@Luis_AM3C wrote:

Hi,

 

Replace Array Element.png

 

Best Regards,


There's no need for the in place element structure here since the replace array subset already works in place.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 6 of 8
(4,959 Views)

Hey thanks you all for your answers very usefull. In fact i thougt that the variables have the same meaning than in C. And for the last solution Luis_AM3C witch fonction do you use to make this stange loop ? I should precice that i'm a labview beginger and i'm far from know all the techniques qnd functions 🙂   thanks every one once again by

0 Kudos
Message 7 of 8
(4,928 Views)

Sory for the question i just open everything i found it. i'll test this solution and tell you if it worked by

0 Kudos
Message 8 of 8
(4,927 Views)