LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Array Manipulation

Solved!
Go to solution

We have one array which contains values and empty strings, what we are trying to do is if 2 or more values are coming continuously we want to concatenate them in one index by setting tab as delimiter, but what is happening is, it is concatenating all the values in one index only even if there is empty string between two indexes.

 

below i am attaching the code with the input and the expected output and the output that we are getting.

 

 

Download All
0 Kudos
Message 1 of 7
(2,941 Views)

Hi,

 

we made some changes to the code  but still not getting the expected solution.

 

attached below is the new code.

0 Kudos
Message 2 of 7
(2,930 Views)

 

If haven't taken a good look but your shift reigster in your FOR loop is being replaced every loop by the single build array and then replacing the previous shift register contents.

Most likely you want to include the previous shift register array contents in your Build Array.

0 Kudos
Message 3 of 7
(2,920 Views)

tyk007,

 

Thanks for the reply, can you elaborate little more , because if i am trying t include the previous shift register array contents in build array the output is we are getting values at two indexes for every values that it is concatenating ( one is without concatenation, and at other index with concatenation).

 

below i am attaching the image of the output we are getting.

0 Kudos
Message 4 of 7
(2,912 Views)

hi RChoudhary,

 

your code offers room for simplification e.g.

a shift register may be way too much just to get the i+1 element of your input array. How about the index array function and the increment +1 primitive?

 

or.png

 

 

 

Regards,
Alex

 

Message 5 of 7
(2,875 Views)
Solution
Accepted by topic author RChoudhary

Alex,

 

It is almost always better to use Replace Array Subset than Insert into Array, especially in a loop. Using Replace Array Subset also allows elimination of the concatenation of a 3-element empty array.

 

The Empty String/Path? comparsion checks directly for an empty string.

 

RChoudhary,

 

You mention using a tab as a delimiter but have line feed (new line) wired into your code. Which do you really want?

 

Lynn

Message 6 of 7
(2,861 Views)

Hi Johnsold,

 

I am using linefeed as delimiter only, by mistake i wrote tab.

 

Thanks for the solution.

0 Kudos
Message 7 of 7
(2,853 Views)