LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

type cast explanantion

Solved!
Go to solution

The note about flattening/unflattening is important because it indicates that the LabVIEW Type Cast does not always reinterpret data in-place. Depending on the type of data, it may copy data to a temporary buffer as a string, then convert that string to the new desired data type. This copying can be a substantial amount of time for a large array, particularly on a resource-limited device like a RIO (I've run into this, sadly, in trying to take a string received over TCP and push it to a FPGA through a DMA FIFO as an array of U32 or U64).

0 Kudos
Message 11 of 14
(519 Views)

Here's something I wrote up many years ago. Still true! Smiley Very Happy

 

 


LabVIEW Champion Do more with less code and in less time
0 Kudos
Message 12 of 14
(505 Views)

Well, that depends on which well you're referring to, and how well that well perform its water gathering function. Smiley Happy

(case in point)

/Y

G# - Award winning reference based OOP for LV, for free! ADDQ VIPM Now on GitHub
"Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
Certified-LabVIEW-Developer
0 Kudos
Message 13 of 14
(460 Views)

Actually flatten and unflatten are specifically inspired by the actual operation these functions do for non trivial and non scalar data.

And array of strings is in fact a memory area with one pointer for each string that points to another memory area somewhere to store the string contents. So the data structure is highly unflattended in memory with various memory areas all over the place containing the information that make up the data.

Flatten takes all these memory areas and copies them into a single contiguous memory block in the logical order of the data. Unflatten does accordingly the opposite by interpreting the data in a single memory block according to a datatype definition and reconstructing the data in memory as the original non-contigouos collection of data.

And yes for anything but scalars, clusters only containing scalars or simple arrays of scalars, flatten and unflatten can simply not operate in place, since the source and destination are then always in a highly incompatible memory layout.

Rolf Kalbermatter
Averna BV
LabVIEW ArchitectLabVIEW ChampionLabVIEW Instructor
Message 14 of 14
(453 Views)