08-12-2009 01:32 PM
Hi, I am trying to output the test data to string indicator as you can see below,
but with "For" loop logic it is only displaying last number, so if you were to execute this, you will see
following output.
Test#6
If I move the concatenate string block outside of For loop, you will the output as below.
Test#0123456
However I want to achieve following output. Can someone suggest me a way to do this?
By the way I have use the For Loop.
The output I want to display with the For Loop
Test#0
1
2
3
4
5
6
Thank you
Solved! Go to Solution.
08-12-2009 01:50 PM - edited 08-12-2009 01:52 PM
Close but no cigar.
You need to concatenate the string using a shift register.
This will be the output:
08-12-2009 01:56 PM
To achieve the output you want, you can use two concatenate string functions, one inside the For loop and one outside. On the inside one, you want to keep that End of Line character after the index number. On the outside one, you can put the "Test#" in the first input and wire the array of strings from the For loop to the second. See below.
08-12-2009 01:58 PM
As you wrote the VI it only outputs the value from the final loop iteration (output indexing is disabled).
Moving concatenate strings outside concatenates "Test" with a 1-D array "0","1",..."6" and finally CR. The 1-D array just concatenates all elements.
If you want the final string to be what you showed (after the for loop) then follow the path to "string" in the following VI.
If you want what I think the sensible thing is, follow the path to "string 2" with the shift register.
(...Ah, too slow)
08-12-2009 01:58 PM
Photon Dan is correct. You can move the concatenation of Test # outside of the loop.
It won't hurt to keep it in the loop, since it is just overwritten each iteration.
But for the sake of efficient coding, you should move it outside of the loop.
08-12-2009 02:16 PM
Thank you all for your answers.
This will do it for me.