LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a sizeof() vi in labview?

I would like to get the size (in bytes) of various labview data types. Is there i vi which will do this? I can't find one. It seems flatten to string followed by string length does the job, but its a of shame having to create a string just for this...

Ian
0 Kudos
Message 1 of 7
(3,796 Views)
That's the way I do it. It's quite useful when sending TCP/IP headers as structures: I just flatten the structure to a string, and get the string-length of it. The receiver should receive that many bytes and then unflatten it.

If the structure is not dynamic (has no arrays or strings), then you can do it once and store the size someplace.
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

Message 2 of 7
(3,797 Views)
Look in Array Functions, and pick "array size". It will give you the size of each of the dimensions in your data array.

Eric
Eric P. Nichols
P.O. Box 56235
North Pole, AK 99705
0 Kudos
Message 3 of 7
(3,796 Views)
Hi Coastal

I do not think that flattening is the proper way to do it. "Flatten to string" will add additional elements before every compound of a struct, describing the type of the variable.

I think, that the proper way is to use "TypeCast" function, located in "advanced->datamanipulation". That will not add any extra elements to the flattened structure.

regards
Pawel
0 Kudos
Message 4 of 7
(3,767 Views)

@pawel wrote:
I think, that the proper way is to use "TypeCast" function, located in "advanced->datamanipulation". That will not add any extra elements to the flattened structure.



Hi Pawel !
That works...except if you try to wire a cluster containing a string ! 😄 😄 😄
CC
Chilly Charly    (aka CC)
0 Kudos
Message 5 of 7
(3,755 Views)
Hi Chilly Charly

You are absolutelly right. One hour ago I post a mail with this question. :).

cheers
Pawel
0 Kudos
Message 6 of 7
(3,752 Views)


@pawel wrote:
Hi Chilly Charly

You are absolutelly right. One hour ago I post a mail with this question. :).

cheers
Pawel



Sure, I rated it 5 stars. It's a very odd behaviour...

Cheers,

CC
Chilly Charly    (aka CC)
0 Kudos
Message 7 of 7
(3,750 Views)