03-15-2018 12:20 PM
Hi all,
I'm using LabVIEW 2016. I have this complex structure in an array of clusters:
Top level - array
Second level - cluster
Third level - array
Fourth level - cluster
Fifth level - numeric (double) elements
(Don't ask me why this is so complex, I inherited the code, and I'm trying to work with it).
Now, in my program, I want to update the numeric elements for, say 30 seconds, as new values come in every second. At the end of 30 seconds, I want to output the juggernaut array of clusters. Obviously, each cluster of numeric elements is unique, so I have to update those specific elements within the specific cluster, at the specific array index, within the specific cluster, at the specific array index.
So it's not an easy case of using shift registers to hold the values through multiple iterations. I even tried a 3D array, but I still don't have the code right. Is there a different way of doing this? I would appreciate any help!
Solved! Go to Solution.
03-15-2018 12:30 PM
Please attach a simplified version of your code, at least containing the data structures. All you probably need is a single shift register containing the toplelel array and a pyramid of "in place element" structures.
03-15-2018 01:22 PM
Hi altenbach,
Attached is a simplified version of my subVI. This is my latest attempt. I'm using a copy of the incoming array and trying to update the elements in the copy each time a new array comes in. It doesn't really work as intended. And, of course in my original code, the clusters are all typedefs.
03-15-2018 02:01 PM
Maybe you want to keep the current values in a feedback node, replacing the array constant with one element that limits the outer iteration to one.
Maybe something like this? (assuming that the outer array size remains constant).
Also note that much of your code could be replaced by min&max and IPEs. Also note that since you replace all elements of the outer cluster, there is no need for your bottom code where you feed many things across unchanged.
This is probably not quite right, but will hopefully give you some ideas....
03-15-2018 02:14 PM
Hmm... I've never used a feedback node. Looks interesting. I'll try it out and let you know. Thanks!
03-22-2018 06:36 PM
So I kept the 2 FOR loops with IPEs the same, but on the suggestion of another LabVIEW programmer, I did use shift registers on the outside in place of the feedback node.
Thank you!
03-22-2018 07:19 PM
And now you know.....
Why not go all "Paul Harvey" ?
That "Code Smell" is known as a "God object"
Drat, there are at least 3 good Google search links in this I cannot link via an Android .
...The rest of the story.
03-22-2018 11:48 PM
@abvenk wrote:
... but on the suggestion of another LabVIEW programmer, I did use shift registers on the outside in place of the feedback node.
My advice: Never listen to "another LabVIEW programmer". Who is it? What are his qualifications?:o
For example there is no "globally initialized" shift register unless you add more code to work around that limitation. A shift register also needs a dummy loop as a scaffold. These are some of the reasons I suggested the feedback node here. Keeps it simple! 😄
Can we see your final code?
04-17-2018 02:46 PM - edited 04-17-2018 02:58 PM
Haha you're funny
Here's the final version. I have 2 cases "Collect" as you see below, and "Send" where I initialize the shift register to a null array, and connect the input shift register to the indicator.
04-17-2018 05:03 PM - edited 04-17-2018 05:09 PM
That's just a truncated image with little information content. How about the actual VI?
Some observations: