User | Kudos |
---|---|
9 | |
5 | |
4 | |
3 | |
3 |
Updating a value within an array of cluster is too complicated compared to other programming languages.
In my application I hold an (global) array of jobs to do, each consisting of its name and an array of (different) parts belonging to this job. One element of the part's description is the number of parts already done. If I want to update this value, the code looks:
Note the calling function has to update the global variable after updating or JobFilesIn and JobFilesOut can be replaced by reading/writing the global which does not make the code more visible.
Within C code the update would look
JobFiles[JobFileIndex].Parts[PartIndex].Done=Done;
which will not raise the need of making it a function (VI) at all.
A solution might be similar to Replace Array Subset if the compiler is parsing the data type on the input and accepting indices and cluster element names as shown below
Of course this should work with any data type selected from the initial variable by the selectors similar to C code
variable[index].element=array;
It also should accept a cluster as top level element as well, e.g. to replace an element within an cluster of clusters similar to C code
variable.element.subelement=WhateverDataTypeThisIs;
or an element within an array which is part of a cluster.
variable.element[i]=WhateverDataTypeThisIs
All the C code examples above expand to LabVIEW code which is hard to read.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.