12-07-2018 04:14 AM
hey every one,
i want to know the method to output the converted data from string to hex (byte by byte) after each iteration of for loop
please see the attached picture
thanks in advance
12-07-2018 04:42 AM
The output of the for loop is configured as last value. So, you'll get (wait for it...) the last value.
Change it to indexing. That will give you an array. Use Concatenate Strings to convert the array to string.
Number to Hexadecimal String does the same as the Format Into Sting, but it works on arrays. So you don't need the for loop. You'd still need the Concatenate Strings.
You can lose the array size, the auto indexing on the input array will automatically loop over all elements.
12-07-2018 05:23 AM
Basically this is the small part of my program, basically i am transmitting a string from one com port and receive it on another com port, then i provide the selection buttons to get the transmitted string in hex,binary,decimal or Ascii. I use the same string indicator for all data formats and case structure for selection. when i select the tunnel for indexing mode the connection error occurred... whats the solution for that ??the picture of VI is attached
12-07-2018 05:36 AM
You removed the String to Byte Array.
Now you're casting a string to a single byte, so only the first byte will be converted.
Either go back to String to Byte Array, or cast to an array of bytes.
12-07-2018 05:40 AM
And just a hint:
Handling those Booleans, ASCII, Hex, Decimal, Binary, will be a hole lot easier if you refactored them to a radio button (Raw, ASCII Hex, .ASCII Decimal, ASCII binary). Raw, Hex, Decimal and Binary are mutually exclusive. The radio button will be an enum, so you only need to implement 4 cases in one case structure. That will make 80% of that code redundant.
12-07-2018 08:13 AM
@Arslan125 wrote:
the picture of VI is attached
And that's a big problem. Pictures of VIs omit a lot of information, not the least of which is "What Version of LabVIEW is the Poster using?". If you are using LabVIEW 2016 or higher, there is a "solution" to your Post Title, passing values out after each iteration of For loop. So either Post your Code (attach a VI) or reply saying "I'm using LabVIEW xxxx".
Bob Schor
12-07-2018 11:35 AM
To answer the question that Arslan125 asked: You can output the data from each iteration of a for loop using a Queue. See the attached example snippet.
12-10-2018 02:25 AM
@EndigitBryan wrote:
To answer the question that Arslan125 asked: You can output the data from each iteration of a for loop using a Queue. See the attached example snippet.
I'm not sure what question that answers?