LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

pretty simple

I'm trying to make a graphic that has 8 lines, and 8 channels. Each time I press or unpress the checkbox the graphic appear or disapear. But the way I'm doing it is not working. I hope someone can help me.
0 Kudos
Message 1 of 24
(3,231 Views)
Yeah, that's not going to work. There's a number of problems with that VI. I don't quite understand why you're taking the for-loop iteration and changing to the values of 33 to 40. Is there a reason for this? Even if there is, a simple Add will accomplish that by adding 33 to the iteration terminal. A formula node with a switch statement is way overblown, even in text-based languages. To hide a plot you need to use property nodes to select the active plot and then use the "Visible" property to hide/show it. See attached mod. A cluster is used to contain the individual on/off controls so it can be easily convert to an array for auto-indexing. An array could have been used as well.
0 Kudos
Message 2 of 24
(3,220 Views)

Edit:  Forgot to include other problems with original code and why it wasn't working...

  • In the False part of your inner-inner case structure you are wiring out an empty array. So what happens is that once you get to a Boolean that's off, your array gets reset to an empty array. If the rest of the Booleans are on, then those are the only ones that get added. For example, let's say you turn off channel 3. Channel 1 adds an array. Channel 2 adds an array. Channel 3 wipes everything out. Then Channel 4 adds an array, and the rest do as well. Thus, you end up with 5 channels rather than simply turning off channel 3.
  • You are also using an uninitialized shift register. This means the wire carrying this 2D data keeps growing each time you run the VI (thereby increasing memory usage even though you're simply generating the same set of data). Since you are not connecting to the output shift register you don't see this, but it's there.
  • I'm guessing you're probably using the Run Continuously button since you have no loop. You should not do this. The Run Continuously button is the same as if you keep clicking the Run button. It should only be used for specific debugging situations, and this isn't one of them. A loop should be used to keep the VI running.
  • If you are going to create an array where the values are all the same, use the Initialize Array function instead of a for-loop.
0 Kudos
Message 3 of 24
(3,213 Views)
It's a pretty nice attempt you did. But the way the vi is already done cannot be changed. I need to find a way of doing what you did but I have to maintain what it's done.
0 Kudos
Message 4 of 24
(3,201 Views)

danilorj wrote:
It's a pretty nice attempt you did. But the way the vi is already done cannot be changed. I need to find a way of doing what you did but I have to maintain what it's done.

This is silly! There are so many things wrong with your VI. For example your 2D array will grow witout bounds if you run the VI consecutively.

 

Instead of the empty array diagram cnstant is all the FALSE cases, you need to wire the 2D array across the structure. try it!

0 Kudos
Message 5 of 24
(3,194 Views)
You mean that I must remove all 2D arrays of the false condition, ok? The false condition would be empty, and I have to put only one 2D arrray out of the case structure. Why of this?
0 Kudos
Message 6 of 24
(3,148 Views)

You are building an array in a shift regsiter. Right?

 

Whenever a FALSE case is encoutered, you are placing an empty array into the shift register, thus deleting everything appended in earlier iterations. If you wire the 2D array across the FALSE case unchanged, nothing is added, but the existing contents of the shift regsiter is retained.

0 Kudos
Message 7 of 24
(3,142 Views)
I can't visualize what you are saying. Could you place this modification on the vi and send it to me ? You can do it only for one channel.
0 Kudos
Message 8 of 24
(3,128 Views)

I just want some code that when the case condition is set to false then it clears the line from each channel. Only this.

I don't know if the use of formula node is a good option.

0 Kudos
Message 9 of 24
(3,083 Views)

As already noted, if you insist on sticking with your design then just wire the data through in the False part instead of sending out an empty array. You also have to initialize the shift register and connect your graph to the shift register, and not create an additional tunnel, as shown in attached image.

 

I'd still like to know why you want to stay with your VI, which is far more complicated than what's already been presented as an alternative. 

0 Kudos
Message 10 of 24
(3,072 Views)