LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Trouble with case structures and while loop initial execution.

Hi,

Ultimately, I'm trying to get six sets of data that is an average of the signal recieved to send to a subvi... I have the average though indexing the signal in a while loop, summing the array, and dividing by the number of iterations (controlled by the user).

I'm running into difficutly because I have a sequence structure, and within the sequence structure I am trying attempt to control the data collection... I have tried both while loops, and case structures, but I'm having trouble.

My problem is that with the case structure, for every case I need to wire a value to my subVI, but I only want to wire my actual number, so this option is out unless I can find a way to not have
to wire all the cases...

And my problem with the while loop is that it has to have its initial iteration... because of this initial iteration, my sequence begins, and continues until the sequence is completed without the direction of the user, so there is no way to control the collection of data. The way I can think of getting around this is to use a case structure, but then I'm back to my original problem.

Any help will be greatly appreciated!

Thanks,
Karinne.
0 Kudos
Message 1 of 5
(3,057 Views)
Hi!

I've been reading at your question and, unfortunatelly, it has been somewhat difficult to understand. I think I found something important to say that may help you.

It seems that your main problem is described here:

"My problem is that with the case structure, for every case I need to wire a value to my subVI, but I only want to wire my actual number, so this option is out unless I can find a way to not have to wire all the cases..."

So, you have a case structure and a subVI outside the case structure ready to receive the information from the case structure depending on the case. But it seems that you have problems because you have to wire something out from all the cases, and some of the information is not suppose to go into your subVI. What you may want to do i
s to condition also the information entering the subVI. You can enclose your subVI inside a case structure (a yes/no type may be enough) and, depending on the case or some other criteria, allow the information access into your subVI.

I hope this can help. Keep posting to know your results and to try to provide you with a more accurate solution.

Regards;
Enrique
www.vartortech.com
0 Kudos
Message 2 of 5
(3,057 Views)
>> because of this initial iteration, my sequence begins, and continues until the sequence is completed without the direction of the user, so there is no way to control the collection of data. <<

Karinne, Put a case structure around everything in your while loop and connect a boolean control to it. The control is something along the lines of 'User wants sequence to execute'. In the false case, the only item is a false constant that wires out of the case to the continue terminal of the loop. In the true case is all your loop code and one more item. This is a true constant that wires out to the continue terminal also. This method is used to make the '1 or more' while loop become a '0 or more' while loop. Obviously this button does not have to be set by the user.
It could, but you could also programatically determine if this condition is true.

Hope this helps,
Jared
Message 3 of 5
(3,057 Views)
The answer looks like get rid of the sequence.
Normally in labview you almost never need a sequence because sequencing is already done by wiring. If wires are attached to subvi's the subvi is only called after all inputs are available.
Please describe your problem in a simpler way and voila you answer your own problem.
you have three steps
one collecting data
two do calculation
three send out result
all this in one while until finished.

good luck
greetings from the Netherlands
0 Kudos
Message 4 of 5
(3,057 Views)
Dear Karinne,

I'm not sure whether I have understood your problem correctly but it seems
to me that you can solve it with local variables.
In many cases it is easier to handle with local variables than using the
traditional dataflow.

Max

-> max.weiss@gmx.de / max@web.de <-
-> Max Weiß * Eulenweg 2 * 76356 Weingarten * Germany <-
-> Fax: 0180 505254775181 * Tel: 0175 1228001
0 Kudos
Message 5 of 5
(3,057 Views)