03-26-2024 08:53 AM
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?
03-26-2024 09:50 AM
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.
03-26-2024 09:53 AM
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.
03-26-2024 10:07 AM
@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:
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.
03-26-2024 12:41 PM
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.
03-26-2024 12:52 PM
@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.