LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Insert into an array

Hello,
 
I am trying to insert into a 1D array a value. When i write the first value, its fine, in the next iteration of the loop, it overwrites it with new value at the same index, Since the array is inside a loop i cannot use autoindex, but what i need is a simple increment to the index of this 1D array after the value has been written so that next time the value is read and is written into the higher index.
 
I am missing somthing very simple.  Kindly help
 
Thanks
 
 
 
0 Kudos
Message 1 of 11
(4,293 Views)
Why don't you use the array index (the small i at the bottom left of the loop) ?
Chilly Charly    (aka CC)
0 Kudos
Message 2 of 11
(4,292 Views)


Message Edited by jrpe on 11-12-2007 04:05 PM
Jeff


Using Labview 7 Express
0 Kudos
Message 3 of 11
(4,284 Views)
What about a shift register and the Build Array function?
0 Kudos
Message 4 of 11
(4,283 Views)

Thanks for all your promt replies.

Well couple of appraches, I have already used up the auto index in the loop ,

since this array is a part of nested for loops, i cant have another for loop inside it, as the number of elements to be inserted is not fixed.

shift register and build array sound good but cant it be something like build array and insert into it array as the prog. executes??

I appreciate your replies.

thanks

0 Kudos
Message 5 of 11
(4,275 Views)
Use either the Insert Into Array or Build Array. No need to use both. With Build Array, you do not have to keep track of the index number. Seeing the actual code you've written will help to find the best solution.
0 Kudos
Message 6 of 11
(4,265 Views)
here it is a part where i m trying to get it going ... i m sure i m doing something really stupid, only thing is that i m not figuring out..
 
the new value still gets written into the same index.
 
Thanks again
0 Kudos
Message 7 of 11
(4,262 Views)

Also let me know how to paste the image in the msg as to just the attachment.

Your inputs are appreciated.

Thanks

0 Kudos
Message 8 of 11
(4,260 Views)

Your value ( s ) will always be at the same location, indexed at 0 (zero).  You are building an array of 1 element, most likely of the last value if you have multiple values.

I only saw part of the code, so I do not know if you have a loop or not..  I will go back top the earlier postings in this thread..

Here is your image:

To display it, simply right-click image, get link from properties - copy it.  Select Options (at top right of your post) and Edit.  CLick on Insert picture icon.  Paste link.  and picture will show up in your post.



Message Edited by JoeLabView on 11-12-2007 04:39 PM
0 Kudos
Message 9 of 11
(4,257 Views)
You are converting a scalar to an array but not doing anything with the old array, so yes each time this code is called, you get a brand new array. The Build Array can have multiple inputs. With a shift register to keep track of the old array, you can add a new element.
0 Kudos
Message 10 of 11
(4,253 Views)