From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I get size of a Cluster in Bytes?

Solved!
Go to solution

I want to get the value of a cluster size, and I found the function 'Get Variant Attribute'  that I think can do this,

but I can't find in the documentation http://zone.ni.com/reference/en-XX/help/371361D-01/glang/get_variant_attribute/

 

Could anybody provide the values that the attribute name can receive?

And this is the right function to get what I need or there is other way?

0 Kudos
Message 1 of 4
(2,472 Views)
Solution
Accepted by topic author MarcoRacer

Hi Marco,

 

GetVariantAttribute cannot give you the size of a cluster - it will give just you the attribute(s) of a variant!

You can create attributes with any name (but not empty string)...

 

Why do you need the bytesize of a cluster?

Maybe you could serialize it into a string and get the string length. Or typecast to an array of U8 and get the arraysize...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 4
(2,470 Views)

I need the size in Bytes because we have a function written in C++ that needs this value!

 

Actually I need a bytesize os a cluster because depending on the format selected, the values inside the cluster will be different!

 

So the best way to do this is serialize in string and get the lenght?

 

Best Regards,

Marco

0 Kudos
Message 3 of 4
(2,454 Views)

flatten to string works!

Thanks!

Message 4 of 4
(2,423 Views)