cancelar
Mostrando los resultados de 
Buscar en lugar de 
Quiere decir: 

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
Mensaje 1 de 11
4.567 Vistas
Why don't you use the array index (the small i at the bottom left of the loop) ?
Chilly Charly    (aka CC)
0 kudos
Mensaje 2 de 11
4.566 Vistas


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


Using Labview 7 Express
0 kudos
Mensaje 3 de 11
4.558 Vistas
What about a shift register and the Build Array function?
0 kudos
Mensaje 4 de 11
4.557 Vistas

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
Mensaje 5 de 11
4.549 Vistas
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
Mensaje 6 de 11
4.539 Vistas
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
Mensaje 7 de 11
4.536 Vistas

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

Your inputs are appreciated.

Thanks

0 kudos
Mensaje 8 de 11
4.534 Vistas

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
Mensaje 9 de 11
4.531 Vistas
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
Mensaje 10 de 11
4.527 Vistas