From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Adding elements to multiple array elements and concatenating arrays to strings

Solved!
Go to solution

Hi,

 

I need help in merge multiple arrays while adding other elements to array element. The desired outcome is a string of command based on the concatenated array elements.

 

Please have a look at LV code with desired output as i am not getting the desired output.

 

thanks,

0 Kudos
Message 1 of 4
(2,954 Views)
Solution
Accepted by topic author weeke

Here's an alternative version.

Explanation as follows:

  • You want to carry out some operation on a set of inputs, the same way each time. Since you have a known number of input sets (in this case, 2) a For loop is what you want
  • You want to create some string based on a set of inputs. The Format to String node is perfect for this, and makes the structure a little clearer without requiring so many inputs to a Concatenate String node.
  • Within the loop, I use a Concatenate String to add an End of Line Constant. You can also do this in the format string, by using the slash display (as you originally had), but I didn't check which type of end of line constant you might want. The Constant I wired gives the platform default.
  • After the loop, I use Concatenate Strings on an array of strings to produce a single string. Since each individual string is terminated by the end of line constant, you get a set of lines of strings.

Take care to have the same number of inputs in each case - the For loop will stop at the shortest array input (to check this, delete one of the values and see that you only get one line).

Also, be aware that the first value (0, 1) could be represented using 'i', the iteration count value, inside the loop. This might always be true (if your numbers are always 0, 1, 2, ...) but maybe you want to add commands in weird orders, so I connected to the given array input.


GCentral
0 Kudos
Message 2 of 4
(2,929 Views)

Hello Thanks,

 

I cannot open the attachement file due to latest version issues. I am using version 15.

 

Is it possible to revert to older version?

0 Kudos
Message 3 of 4
(2,910 Views)