LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how can I stop a for loop that is placed inside a while loop and another for loop?

Hello, first of all sorry for my english. I'm working with DACmx. I receive a signal (an array) with 5000 samples per second. I have a while loop (main while loop) for reading this signal, but I can read only the first sample. For reading all data I'm using inside the while loop a for loop with N=5000 nested to another while loop, which is nested to the main while loop too. But when I stop the main while loop the another don't stop. What can I do?
Thank you very much.
Luz
0 Kudos
Message 1 of 16
(4,102 Views)
Hello Luz,

you cannot stop a FOR loop. But you can do 2 things:
1) replace the for loop with a while loop. Now you can have more than one stop signal for this loop (reached 5000 iterations OR main stop button).
2) place a case structure inside the for loop containing all code of this for loop. Wire the main stop button to this case structure (use a local variable to get the most current state of this button!)


Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 16
(4,082 Views)
Hello luz,

I'm not sure I understand what you want to do... You can stop the FOR loop before it has run the specified number of time (5000 in your case) ; if you mean you want to stop the 2 WHILE loops at the same time, then the way to do it will depend on how they placed, can you post your VI ? That would be easier to help you... 😉

We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 3 of 16
(4,080 Views)
Thanks, TITou and Gerdw, I send here my file so you can understand what I'm trying to do. The variable Y is an array of 5000 samples, and it is changing. I want a variable that contains all the components of the array, one after another, and iteration after iteration.
 
Y(0)_iteration1
Y(1)_iteration1
.
.
.
Y(5000)_iteration1
Y(0)_iteration2
Y(1)_iteration2
.
.
.
Y(5000)_iteration2
Y(0)_iterationN
Y(1)_iterationN
.
.
.
Y(5000)_iterationN
 
Thank you very much
0 Kudos
Message 4 of 16
(4,077 Views)
Hello Luz,

I changed your vi a little bit. Now it should do what you said it has to do.

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 16
(4,070 Views)

Thanks GerdW. I need what you do, but not like an array. I want "collected Y data" like a number, not like an array. Can you help me?. Thank you very much.

Luz 

0 Kudos
Message 6 of 16
(4,072 Views)
Hello Luz,

what exactly do you want?
If you want a number, it can only contain one value. If you want all values, you need an array. OR: you convert all values to strings and concatenate those strings. But be aware: this string can grow and grow and this can lead to problems (memory consumption, loop time will increase and so on).

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 16
(4,057 Views)
Thank you another time, I haven't a good english and it's dificult for me to explain what I want. I need a number, but I need this number changes often than Y, exactly 5000 times faster than Y. I need monitorize all the signal values, can't you help me?
0 Kudos
Message 8 of 16
(4,059 Views)
Hello Luz,

I don't understand what you are trying to do...
How fast do you aquire the 5000 Y values? How fast should be the display of those Y values?
How fast can you watch these values? If you display 10 values per second you need 500s (or 8.3min) to display all 5000 values...

Maybe a chart control can help you.

Message Edited by GerdW on 03-08-2006 01:09 PM

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 16
(4,047 Views)
 
0 Kudos
Message 10 of 16
(4,035 Views)