LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with hex and normal display

Hi,

I'm doing some kind of conversion numbers in desired type and in the end I am using function Flatten to String. I obtained good results as a string in hex display (for example 2440), but in normal display I get some 'weird' characters (𝔡). Now I want to concatenate hex display with some string constant, for example I want to obtain string: 2440 is wanted number, but if I use concatenate string, I rather get 𝔡 is wanted number or everything in hex form. I tried several ways to convert hex display of string to normal which should have completely same values as hex, but none of these solution worked. What should I do?

0 Kudos
Message 1 of 6
(241 Views)

It sounds like you should be using Number To Hexadecimal String instead of Flatten To String.  This will make an ASCII encoded hexadecimal value.

 

Depending on what you are trying to do, you may also want to have a good look at the Format Into String, which can do the string concatenation at the same time.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 6
(202 Views)

You need to attach your code to better describe what you are attempting. 

 

Many people that are looking to help only have LabVIEW 2019 or earlier.  Please save your vi in an earlier version rather than the current release.

Help the Community (and future reviewers) by marking posts as follows:
If it helped - KUDOS
If it answers the issue - SOLUTION
0 Kudos
Message 3 of 6
(197 Views)

@labanja wrote:

Hi,

 in normal display I get some 'weird' characters (𝔡). Now I want to concatenate hex display with some string constant, for example I want to obtain string: 2440 is wanted number, but if I use concatenate string, I rather get 𝔡 is wanted number or everything in hex form. I tried several ways to convert hex display of string to normal which should have completely same values as hex, but none of these solution worked. What should I do?


These "weird characters" may come, because "prepend array or string size? (T)" is enabled by default, and four bytes attached to the beginning of the string, depends on size you might get any chars, include non-printing. Try to set to false:

Screenshot 2024-03-26 15.58.59.png

When string displayed as Hex Display, then you see the bytes representation of the characters, but when this option is disabled, then you will see according ASCII characters, and for some codes they are non-printable, or "weird".

On the other hand, as stated in the comments above it is very strange that you using Flatten to String primitive for such conversion, its very unusual. Show your code please.

0 Kudos
Message 4 of 6
(191 Views)

The display is a purely cosmetic property of the control/indicator and determines how the raw string data is presented to the user. It has no bearing on the data inside the wire.

 

Please attach a simple example and explain exactly what you want.

0 Kudos
Message 5 of 6
(152 Views)

@Andrey_Dmitriev wrote:

On the other hand, as stated in the comments above it is very strange that you using Flatten to String primitive for such conversion, its very unusual. Show your code please.


Using Flatten To String is not strange.  I use it all the time.  The real question is what the OP is actually trying to get as an output.  Based on the description, I think they actually wanted the Number To Hexadecimal String.  But I am only 70% sure about that.  As Bilko stated, an example VI with expected inputs and expected outputs saved in the controls and indicators would be immensely beneficial to help us help the OP. 


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 6 of 6
(148 Views)