LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

add data to an existing array

Hi ,
 
  Using a FOR loop , i generated random binary bits , a total of 10 bits , which resulted in an array of size 1*10 . now i wish to add  a further 5 bits to the existing array to make the array of size 1*15 . not sure how to add data to an existing array and extend the size of the array. Hoping someone can help me with this simple step .
 
Motorhead ..
0 Kudos
Message 1 of 6
(2,640 Views)

Use Build Array or Insert into an Array function found in Array palette.

I think you should go through the LV basics.

0 Kudos
Message 2 of 6
(2,638 Views)


motorhead wrote:
  Using a FOR loop , i generated random binary bits , a total of 10 bits , which resulted in an array of size 1*10 . now i wish to add  a further 5 bits to the existing array to make the array of size 1*15 . not sure how to add data to an existing array and extend the size of the array. Hoping someone can help me with this simple step .

These are very basic operation, but first you should get the nomenclature clear.
 
If you say 1*10, I would understand that you have a size=1x10 2D array.
 
Most likely, you have a 1D array of size 10 and wish to append a 1D array of size 5 to result in a 1D array of size 15. If you actually have 2D arrays, things bet a bit more complicated.
 
 
"Built array" is the right tool, but you must ensure that it is configured to "concatenate Inputs" (right-click to change, see image). If you don't, you'll end up with a 2D array.
 
 
It would always help if you could attach a small sample program, because your description is quite poorly defined.
  • Is this just a static one-time operation on fixed arrays?
  • Do you want to add to an existing array in a loop, e.g. add the new array to the array from the previous iteration?


Message Edited by altenbach on 05-25-2008 10:16 AM
0 Kudos
Message 3 of 6
(2,622 Views)
  • Is this just a static one-time operation on fixed arrays?
  • Do you want to add to an existing array in a loop, e.g. add the new array to the array from the previous iteration?

thank you all for your patience .... i should have described the problem better ...

 
I cannot use the build array  block which is why i found myself stuck , because my DSP board (dsk 6713) does not support this block . so
i was looking for a alternative .. one where i do not have use the build array block , but another option instead . . 
iam attaching the simple vi.  thank you for all your help ..
 
Motorhead ...


Message Edited by motorhead on 05-25-2008 10:46 PM
0 Kudos
Message 4 of 6
(2,595 Views)
Sorry, I am not familiar at all with LabVIEW DSP, but as you noticed it is much more limited. In particular, array sizes are apparently fixed according to the following link.
 
Can you maybe allocate a 15 element array and then replace the first 10 and later the last 5 elements?
 
Maybe the LabVIEW embedded forum might be a better place to pose this question, not sure:
 
I hope somebody familiar with LabVIEW DSP has a solution for you. Good luck! 🙂
0 Kudos
Message 5 of 6
(2,581 Views)
Hi Motorhead,
 
The DSP module does not have dynamic memory allocation capabilities, so you must initialize the array to a particular size that cannot be changed during execution.  As Altenbach suggested, you will need to allocate an array with enough elements, and then fill in empty elements as you go.  For more information on this, I recommend taking a look at the KnowledgeBase article, How Can I Be Successful With Arrays with the DSP Module?
 
Regards,
 
Lauren
Applications Engineering
National Instruments
0 Kudos
Message 6 of 6
(2,541 Views)