LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

GRAPH 1D STRING ARRAY BY BYTE

Solved!
Go to solution

I have an array of strings that contains 9 bytes each.

0XAB43B3D489EE9DD739 -> String 1

0XA7B3CD2CC2C30AEFF3 -> String 2

0X39572B3A8AAC2C7A34 -> string 3

 

.

.

.

 I would like to take each byte of every string and plot it in 9 different graphs.

As a result from the data above we would have:

Graph 1 -> AB, A7, 39

Graph 2 -> 43, B3, 57

Graph 3 -> B3, CD, 2B

.

.

Graph 9 -> 39, F3, 34

0 Kudos
Message 1 of 14
(3,644 Views)
Solution
Accepted by topic author aztech2019

Here's how to do 9 plots on one graph, so modify as needed. (there are many ways to do this, of course).

 

PlotBytes.png

Message 2 of 14
(3,630 Views)

Here is an alternative method using a pre-made enum.

Convert%20Byte%20String%20to%20Integers%20and%20Graph

0 Kudos
Message 3 of 14
(3,596 Views)

Hi Paul,

 

what's the Enum good for?

 

Two more ways:

check.png

Even loopless:check2.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 14
(3,588 Views)

It is just a way of instructing the Scan from String to only use 2 characters at a time, similar to what you have done.  I like your method of scanning but I think my method of loop control is better - no dud values and the poster has a 1D array of strings.

0 Kudos
Message 5 of 14
(3,582 Views)

Hi Paul,

 

It is just a way of instructing the Scan from String to only use 2 characters at a time

First you have to create that enum: can be a long time to type in all those 256 items…

 

no dud values

What is "dud"?

 

the poster has a 1D array of strings

Ah, yes: replace the SearchAndReplaceString in my images by a simple ConcatString when the input is already an array of strings.

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 14
(3,579 Views)

I used a loop to set the strings in a Ring and then replaced it with an Enum so only a little time required.

By "dud" I mean when the input string is empty into the Scan from String function and so a 00 is scanned at the end. Your reshape array crops it off.

0 Kudos
Message 7 of 14
(3,576 Views)

The OP says that each string contain 9 bytes. Also, he prepends 0X to the string value.

This makes me think that he only needs to convert to U8.

example3.png

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
Message 8 of 14
(3,567 Views)

@pincpanter wrote:

The OP says that each string contain 9 bytes. Also, he prepends 0X to the string value.

This makes me think that he only needs to convert to U8.

example3.png


Yes - if the OP copies and pastes each string into a string constant/control that has been set to the Hex display mode (which is really changing the value of the string to the actual binary characters)

No - if the OP is getting the hex-formatted string value from another VI, then it won't give the correct result.

 

It really depends on what options there are for getting the string data in the first place. If the binary data is available without being formatted into Hex, then that would make it a lot simpler.

0 Kudos
Message 9 of 14
(3,540 Views)

@pincpanter wrote:

The OP says that each string contain 9 bytes. Also, he prepends 0X to the string value.

This makes me think that he only needs to convert to U8.


That's how I read it...

0 Kudos
Message 10 of 14
(3,524 Views)