LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

building arrays

Hello,
 
      I would like to update a 8 element array, one bit at a time when I am in a while loop. I have initailzed the array with the initialize vi and am using the "insert into array" vi when I am in the while loop to update each element. For some reason when I get out of the while loop the size of the array is 9 and the data in the array is wrong.
 
Any ideas out there as to what I am doing wrong?
 
Kaspar
Regards,


Kaspar
0 Kudos
Message 1 of 21
(4,323 Views)
Well, the obvious answer is that you're running the loop one too many times. My guess is that you're using "greater than" instead of "greater than or equal to" or something similar. Since you're using the Insert Into Array function, LabVIEW dutifully increases your array at the ninth iteration. Besides, if you already initialized the array you should be using Replace Array Subset.
Message 2 of 21
(4,315 Views)

It would help if you could show is some real code. Show us how you're doing things. Instead of saying "... is wrong", please show us what you got and what you expected to get. 😉 We are not clairvoyant!

Clearly, you need "replace array subset" to change the value of an existing array element. "Insert into array" will grow the array with each iteration. Check the online help for both functions. If your final array is size 11, it means that the loop ran only for one iteration. How many elements are you trying to replace?

Message 3 of 21
(4,317 Views)
Hello,
 
      I am sorry for not putting my code on the original posting. I will see if I can do that, it is part of large Labview project. I can see that I need to use the replace array as opposed to the insert array. Thank you for your responses.
 
Kaspar
 
P.S. Does anyone know why I cannot do a simple cut and paste to a posting that shows the portion of the code I am having problems with? 
Regards,


Kaspar
0 Kudos
Message 4 of 21
(4,282 Views)


@Kaspar wrote:
P.S. Does anyone know why I cannot do a simple cut and paste to a posting that shows the portion of the code I am having problems with? 

You need to take an image of  the code area, then attach that image to your post. What part of the procedure gives you problems?
0 Kudos
Message 5 of 21
(4,272 Views)


@Kaspar wrote:
 
P.S. Does anyone know why I cannot do a simple cut and paste to a posting that shows the portion of the code I am having problems with? 


I often copy the portion of code and put it into paint, then host it through imageshack.us

Regards

Message 6 of 21
(4,265 Views)

ok, I will do the imageshack thing to show the code

 

Kaspar

Regards,


Kaspar
0 Kudos
Message 7 of 21
(4,248 Views)
Hello,
 
  Here is my code, it is my first time using image shack, so I may have hosed something up.
Kaspar
 
 
 
Regards,


Kaspar
0 Kudos
Message 8 of 21
(4,237 Views)
Unfortunately, something did go wrong when you tried to put the image in. Not sure what you did, but here's the picture.
Message 9 of 21
(4,234 Views)

Hello,

   How did you get the picture? now that you got it could you please give me some advice on how I have hosed up the update array? What I have found out that only element 7 gets updated. I am assuming that since I wired up the index to the while counter that all elements of the array would get updated.

Kaspar

 

  

Regards,


Kaspar
0 Kudos
Message 10 of 21
(4,233 Views)