LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to insert element into array without changing size

hi! i am trying to do pilot insertion using labview fpga. the problem is that i can't seem to figure out how to insert elements into array without changing the size of the array. since this is not allowed in fpga labview, i am having problems implementing pilot insertion. can anyone please suggest anything that i can do so that i can insert elements into an array without changing the size of the output but also without replacing the element on the index where i need to insert the element? thanks very much!

0 Kudos
Message 1 of 18
(6,832 Views)

How are you planning to add an element, without replacing any existing ones, and also not increasing the size?

 

It's like asking how, if you have 10 toys, you can buy another toy, not get rid of any of your existing toys, and still have only 10 toys.

 

It doesn't make sense.

Chris
Certified LabVIEW Architect
Certified TestStand Architect
Message 2 of 18
(6,815 Views)

You need to define an array at the maximum size you ever need and keep the information on the location of the last valid element elsewhere, for example.

Message 3 of 18
(6,800 Views)

thanks for your reply. one solution i was thinking of was when i need to insert a new element on a certain index:

 

1. shift the elements of the array to the right (but the shifting will only start after the index where the new element would be inserted)

2. insert the new element

 

but i can't seem to think of a way to do the shifting array such that only selected elements in the array are shifted. thanks very much!

0 Kudos
Message 4 of 18
(6,790 Views)

Can you tell us why you are doing this, and maybe we can tell you a different how to do it that would be easier? You may want to pass the values to be inserted off to the RT. Let the RT manage the array (if you can).

Message 5 of 18
(6,770 Views)
Hi. Looking back, I have actually stated the problem in a complicated way, sorry for that. Actually, I am only trying to insert elements into an array in the following indices: index_of_element_in_array = 7*i + input_number, where i = 0,1,2...,,240. I am trying to use the Insert into Array VI and connect the index to the computed index_of_element where i is the while/for loop counter. LabView FPGA does not allow me to do this since it does not allow variable changing of the array size. I would like to ask if there is another way to do this such that I do not need to use the Insert Into Array VI and LabVIEW FPGA would allow my code to run. Thanks very much!!   
0 Kudos
Message 6 of 18
(6,720 Views)

Hi,

 

what for(imstuck) said.

I feel we need to know something more abput the big picture of your problem, not the tiny portion of it you're focusing on.

 

Regards

Florian

Message 7 of 18
(6,706 Views)

Insert array will do what it says, insert an element into the array, AND resize it accordingly.

 

If this is not what you want it to do, you should not use Insert Array!

 

Instead you would have to do some work of this on your own. The principle would be to allocate a fixed size array in the beginning and maintain how many elements are already in the array. If you now need to insert some data into the array you first move all the data beyond the insertions point by the number of elements that you want to insert. Then copy the data into the array and finally update the bookkeepng about how much data is really in the array. Not as convinient as using a ready made node, but also no rocket science by far.

 

There are no out of the box functions that allow to insert data into an array without resizing the array, which is what you want to avoid for the FPGA code.

Rolf Kalbermatter
My Blog
Message 8 of 18
(6,694 Views)

One of the data elements is going to get left out in the cold.  How do you determine which it is?

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 9 of 18
(6,683 Views)

For the bigger picture, I am trying to develop an OFDM physical layer. I am now in the subcarrier allocation and pilot insertion blocks. So after I have suballocated the symbols (into an array of 1440 symbols), I am now trying to insert some pilot symbols into the array and this is where the problem starts.

0 Kudos
Message 10 of 18
(6,662 Views)