03-17-2023 01:14 PM
Trying to make a class object that has an array. The array element is a cluster that contains timestamp and value.
How do I specify an array size of 3600 elements in the class private section?
Solved! Go to Solution.
03-17-2023 01:36 PM
Put the array in the class private data control.
Type "3599" in the index field. This will move it to the 3600th position.
The values will be greyed out. Click in one of them and type in the existing value, then click out of it and it will then be bolded.
Adding in the 3600th value will have filled in all values from the 1st to the 3599th value with defaults, so you now have a 3600-length array. Right click it, choose data operations, then choose make current value default. Save the class private data and that is your new default.
Note that this doesn't prevent someone later on writing an empty array or an array of any other size to the class data. If you need to prevent that too, you'll need to add checks to the accessor VI you create.
03-17-2023 01:54 PM
Thanks! The "Click in one of them and type in the existing value" was the key. This explains why I was getting 0 size before.
03-22-2023 04:04 PM
Extending on this, what if I want a an array buffer of objects?
When I drag in the obj, its greyed out.
So do I need to instantiate an object with default values and then put that in the array?
03-22-2023 05:37 PM
If you create your array of objects, then right-click on any object in the array (not the array border) and select "Data operations ► Reset to default value", that should have the same effect where it fills in that object and all of the ones above it with bolded array elements.