11-04-2014 02:29 PM
To be more correct you should make that "Replace with NaN" to a sub-vi you place 4 times. 🙂
/Y
11-04-2014 02:30 PM
Ok. I don't really know what a sub-vi is but I'll do some googling and figure it out. Thanks!
11-04-2014 02:45 PM
A subVI is the same as a function or method in other languages.
In LabVIEW, you'll configure the connector pane to control your input and output parameters. Then you'll run the logic. You can place this VI into other VIs and wire the inputs and outputs. That way, you write the code once and can use it multiple times. It's a huge help if you need to debug this code later.
11-04-2014 02:54 PM
You already got the important suggestions. Here are a few more to dramatically simplify your code.
11-04-2014 03:01 PM
@altenbach: Thank you for your suggestions. I understand everything except the cluster container. What is that? I can't seem to find it and how is it different than what I've done i.e. grouped the buttons in a container?
11-04-2014 03:21 PM
@rhupd wrote:
@altenbach: Thank you for your suggestions. I understand everything except the cluster container. What is that? I can't seem to find it and how is it different than what I've done i.e. grouped the buttons in a container?
If you've programmed in other languages a Cluster is a Struct or Type, thus a functional unit when programming. A group is just a way to arrange front panel items. It's in the Array, Matrix and Cluster-menu.
/Y
11-04-2014 03:26 PM - edited 11-04-2014 03:27 PM
@rhupd wrote:
@altenbach: Thank you for your suggestions. I understand everything except the cluster container. What is that? I can't seem to find it and how is it different than what I've done i.e. grouped the buttons in a container?
Grouping is a cosmetic property of the front panel, you still have the terminal clutter on the diagram.
You would place an empty cluster container from the cluster palette, then drop your switches into them. You need to ensure that the cluster order is correct (right-click...reorder ...) to ensure that the elements of the array are in the same order.
Clusters can even contain elements of different datatype. Cluster to array of course only works if all elements are the same type, e.g. boolean in our case.
Here's a quick draft comparing your method and the cluster method. Arguably, the cluster gives significantly less diagram clutter, making the code easier to maintain.
11-13-2014 12:59 PM
Hi everyone,
I think I incorporated all the changes that were suggested but it's still not working properly. I have a feeling it's the loops and auto-indexing business. I've been reading about it and trying to understand it better but I need a second pair of eyes to look at what I've done please. The buttons still aren't working properly.
Thank you!
11-13-2014 01:16 PM - edited 11-13-2014 01:19 PM
Fairly close. I Fixed A-C You get to do the rest
11-13-2014 01:22 PM - edited 11-13-2014 01:23 PM
You need to disable indexing of the boolean array on the outer loop. It needs to autoindex on the inner loop instead.
(EDIT: I guess Jeff was a little faster :D)