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.
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.
01-14-2020 04:26 AM
I am programming a driver for a spectrum analyser. I created gtypes for different settings that I read from the device and write to the device. The Vi's that read the settings have an output of the corresponding gtype. The write Vi's have an input and an output of the gtype. The output is used to get any changes made by the device. On my main panel, I have a control instance for each gtype. After I have read the settings I take the output and wire it to an indicator terminal of the control or a duplicated terminal. To send the settings to the device, I create a reference of the control, use a value property node and feed it to the corresponding VI. This works well so far. However, for the traces setting I have something that looks like this:
I got an array a within this array I have a cluster of different control fields. If I send this item to a VI and start a for loop on the item using auto-indexing, the output of the for loop is a 1-D array of a cluster and not the gtype. This is certainly true, but if I want to use this to update my control values I get a type mismatch error.
I have created a simplified example with a gtype called dummy consisting of an array holding a cluster with 3 control elements.
I can display the output using a new indicator called output. But if I use a duplicated terminal or use a reference + property node, I get a type error.
Has anyone an idea how to fix this problem?
Solved! Go to Solution.
01-14-2020 06:34 PM
It is expected and you will see the behavior in both LabVIEW 2019 and LabVIEW NXG 4.0. When LabVIEW auto-indexes an array in a loop, it is not casting to a specific Array TypeDef. Usually, the type definition will be the element of the array (the data type of the array) not the array itself.
Read more here: How to initialize typedef array without loosing the typedef
All the best,
01-16-2020 05:50 AM
I s'pose you can type cast the resulting array back to the type def'd one.
/Y
01-16-2020 06:36 AM
Thanks for your help. I haven't included the array in my gtype and everything works now.
The type cast vi is complaining as soon as I connect a gtype to its type input. I get the error "Polymorphic terminal cannot accept this data type. Wired type: dummy.gtype"