LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Clone each element in a 1d array multiple times to create a new 1d array

Solved!
Go to solution

For an example 1d array [1,2,3,4,5,6], how to duplicate each element 5 times for instance, to generate a new 1d array as [1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,4,4,4,4,4,5,5,5,5,5,6,6,6,6,6]? 

0 Kudos
Message 1 of 6
(5,299 Views)

This seems trivial. What have you tried so far? What is your LabVIEW version?

0 Kudos
Message 2 of 6
(5,289 Views)
Solution
Accepted by topic author findout

I'll give you the tip you build your own logic.

 

If you have 2013 version:

 

For loop and Initialize array

 

If you have the earlier version:

 

For loop, Initialize array and shift register

-----

The best solution is the one you find it by yourself
Message 3 of 6
(5,283 Views)

Hi findout,

 

that is a question that you can solve by reading some free tutorials, but I am going to show you a very simple example of how you can do it (if your LV version supports the auto-indexing).

 

Concatenate.PNG

Hope it helps, regards!

0 Kudos
Message 4 of 6
(5,225 Views)

@Luis32 wrote:

... show you a very simple example of how you can do it (if your LV version supports the auto-indexing).


All LabVIEW version support auto-indexing. Older version don't support he concatenating output tunnel you are using.

Also, the "replicas" control belongs outside the loops, it should not change during exection.

0 Kudos
Message 5 of 6
(5,212 Views)

Thanks. I created a similar VI with additional Reshape Array function to convert the output into a 1d array.

0 Kudos
Message 6 of 6
(5,190 Views)