LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

cluster index beginning at 1

Hi there,
Is it possible to start indexing the cluster at 1 instead of 0? (since this makes user friendly input)

Any help/pointers/code is appreciated!

Thanks
Jeguna
0 Kudos
Message 1 of 7
(3,290 Views)
I don't think there is an option to do this (like in VB, OptionBase=1). The best thing to do is to create dummy elements for index 0 during an intialize section. Then start with 1 for all your code.
- tbob

Inventor of the WORM Global
0 Kudos
Message 2 of 7
(3,282 Views)
As tbob says, you can't change arrays (I'm sure you mean this and not clusters) to be start at index 1. If, though, you want a front panel array to have a control that starts at 1, you can do that. Right click on the array and deselect Visible Items>Index Display. Put a numeric control on the front panel and make it a U32. Change the range of this control so that the minimum value is 1. On the diagram, create a property node for the array and select Index Values. Wire your numeric control to a decrement function and wire the output of that to a build array. Wire the ouput of that to the property node. Then when the user enters a value of 1 in the numeric control, it will actually be element 0 of the array.
0 Kudos
Message 3 of 7
(3,276 Views)
Hi Dennis,
Yes, you are right it is an array not a cluster. I tried doing the same, but not able to connect "build array" to "property node". Also, the array contacts various data types.

Please see the attached file

Jeguna
0 Kudos
Message 4 of 7
(3,257 Views)
sorry about typo in my reply...

it's not "contacts" => "contains"
0 Kudos
Message 5 of 7
(3,253 Views)
Right click on the property node and select Change to Write. The little arrow inside the node will then show up on the left side, and you will be able to wire to it.
- tbob

Inventor of the WORM Global
0 Kudos
Message 6 of 7
(3,240 Views)
It's cool. Thanks Bob and Dennis.
0 Kudos
Message 7 of 7
(3,230 Views)