07-24-2018 08:17 AM
As in the above snippet, I am not allowed to contatenate the output from a type cast. Why?
I was hoping to end up with a string of length (ROWS*COLS)*64/8, because each element is a 64-bit double, and every 8 bits will be interpreted as an ASCII character. Or am I understanding something wrong?
Solved! Go to Solution.
07-24-2018 08:32 AM - edited 07-24-2018 08:35 AM
07-24-2018 08:54 AM
this surely has something to do with how memory is allocated.
a string is a consecutive block of memory.
if you want to resize (add to) a string, new memory has to be allocated for the whole resulting string and the old part copied into it.
since this is very inefficient, i presume that labview prevents you from doing that.
use gerd's way to circumvent.
regards
07-24-2018 09:11 AM
@dougbockILT wrote:
I was hoping to end up with a string of length (ROWS*COLS)*64/8, because each element is a 64-bit double, and every 8 bits will be interpreted as an ASCII character. Or am I understanding something wrong?
(First of all, you don't need the inner loop. You can cast a 1D DBL array directly.)
Second, all you probably need is a flatten to string without size information prepended, right?
07-24-2018 09:31 AM
My problem is that I want to convert the 2D Array to an ASCII string.
So for the following 2-by-2 array of doubles:
IN DECIMAL
15.458 | 0.123 |
5.007 | 6.540 |
IN BINARY
0100000000101110111010100111111011111001110110110010001011010001 | 0011111110111111011111001110110110010001011010000111001010110000 |
0100000000010100000001110010101100000010000011000100100110111010 | 0100000000011010001010001111010111000010100011110101110000101001 |
concatenated column by column, row by row:
0100000000101110111010100111111011111001110110110010001011010001001111111011111101111100111011011001000101101000011100101011000001000000000101000000011100101011000000100000110001001001101110100100000000011010001010001111010111000010100011110101110000101001
interpreted as ASCII string:
@.ê~ùÛ"Ñ?¿|íhr°@+Iº@(õÂ\)
which has length 32, as expected.
07-24-2018 09:42 AM
(posting by phone, cannot test).
My code should do that. Have you tried?
If you want to do by columns, transpose the 2D array first.
07-24-2018 09:56 AM
@altenbach wrote:
(posting by phone, cannot test).
My code should do that. Have you tried?
If you want to do by columns, transpose the 2D array first.
Works, however I am not getting the same output as expected (done on this website) ... I'll trust LabVIEW on that.
Many thanks!
07-24-2018 09:58 AM
try right click on the string indicator and choose "Hex Display" perhaps this more helpful to compare.
07-24-2018 09:58 AM
07-24-2018 10:05 AM