How to 'continue' a 'while' loop using an "if"?

I have a loop 'while' continuous operation, by taking a step at each iteration. In each such iteration I save this measure unique to the file AND display it on a chart. From time to time, I have "out-of-range" measures, which are displayed as 1E-37 or 1E + 37 on the graph and poured on the record, and are not relevant (for me, it is). With the help of a simple interpreter, like python, I could use an 'if' statement to check if the reading is indeed irrelevant and if so, 'continue' in the loop 'while' so that it stops the current iteration and starts a new.

How we not implements such a thing in LabVIEW?

Thank you

Amit

Hi Amit,

There was no 'cynicism', not at all! You ask a few notions of LabVIEW base so I suggested where to find that...

"but this would require having wrap all code inside the"while"loop."

OK, then you should explain the difference of a IF/THEN construct textual languages. Made a simple

IF test

{do something here}

ON THE OTHER

{do something here}

not wrap the code inside a structure?

A CASE structure does exactly the same thing and I don't see anything more simple as followed by comparison of two cases. What is complicated in a case around another structure design code?

Tags: NI Software

Similar Questions

  • How to have a while loop inside a structure of matter?

    Hi all

    I would like to know how to control a while loop by using the structure of the case? I would like the person to check if the object has is in its original position or not.

    If this is the case, go...

    The object must then do its job, as mentioned in the while loop... as up and down 10blocks...

    Later, when she returns to its original position, the entire process must stop...

    I checked the forums on this http://forums.ni.com/t5/LabVIEW/How-to-stop-while-loops-inside-a-case-structure/m-p/591259

    It is the closest, I can have... but can someone tell me how to program for this? How logic should be?


  • How to increase code efficiency in a while loop (using PXI5105 for sampling outside signal digitalizer)

    Theoretically, we want the PXI-5105 (digitizer) have 302 record with each record has a 1260 sample (the save operation is inside a while loop) in approximately 30ms, however we have found that for each period (30ms), the PXI5105 only perform about 10 records. It is so wired. I wonder if the operations inside the while loop consume more time (for example 3MS), so that he cannot have 302 records even the PXI-5105 have 60 M/s speed of sampling. Is it true, you can find my labview code and if possible can you give me some suggestion in the most short time of operation of the loop.

    Please find attached labview code.

    Hi g_l_g_s,

    The digitizer PXI-5105 acquires data at the speed that you specify and stores the data in its memory embedded (up to 512 MB). The data is then sent to your computer when the Multi Fetch Cluster.vi is called. In VI that you posted, you are only fetch record during each while the loop iteration. If you want to retrieve 302 records you will need to specify 302 files in the horizontal Timing.vi to configure. For more information about scanners, you might find the DevZone, hereuseful.

    To determine the amount of time it takes for each while the loop iteration, you can consider using the structure of code in the example comparison community calendar, which is located here.

  • How to run a while loop continuously without iterate loop inside the fi, a condition is met

    I enclose a VI that once the answer 28 comes the loop must stop and loop should continue an iteration. Can you show me a way for her

    You can stop the loop when a certain condition occurs: http://zone.ni.com/reference/en-XX/help/371361H-01/lvhowto/add_cond_to_for_loop/

    Add a register to offset for the while loop and to implement the feature as below:

  • How to stop a while loop structure in the event of a main vi

    Hello;

    Sorry for my English

    I have to stop to a Subvi my main VI, the Subvi contains a while loop and an event structure, so I need to stop this loop while I tried directly from my main vi, global variable, but it did not work

    any help please or example!

    How about something like this (solution see attachment) using a user event.

    Explore the User Interface--> range of events and dialogue. To display the dynamic event of the terminals in the structure of the event just right click and select 'display the dynamic event posts '.

  • How to reset a while loop based on a value change event?

    Hi all

    I work in a labview program that sends voltage to a laptop via USB 6008, tension is amplified by an op-amp, and then he comes back in the laptop. I created a program and a working circuit, but my current challenge is how to reset the average of the values of voltage coming into the laptop, after that the user changes the digital control (which controls the output voltage). In other words, I need to be able to reset the number of iteration and the sum to 0 each time this happens.

    I looked upward to reset the counters of iteration through shift registers, but I'm not sure it will work in this case, but I'm also not sure how to reset the sum of an array (if possible). I have spent a lot of time to read these forums and tutorials from various sites, so I think it can be done with the correct nesting of the case structures, structures of the event and while loops, but I don't know how. I am new to LV, just started to learn in mid-January, so any help is appreciated.

    Thanks in advance,

    Graeme

    You just need the structure of single event with the bargains.  Use the case of timeout to get your new values and find the average (100ms timeout value and get rid of the wait function (ms)).  Keep the amount and the number of items in the shift registers.  Wire these values through each case of the event.  In the event of changing the value: control, just set the values to 0.  Then add a Stop button value change event to stop your program.

  • How to run a while loop for 0.5 seconds?

    Hello

    I am doing a project and I'm stuck with the programming.

    Some time ago in a loop inside a box structure. When the real state of a structure box is enabled, the loop inside, should run for 0.5 seconds. How do this?

    Thanks in advance.

    Why you want to run a while loop? what you do inside that? If you want to perform any operation for a specific time, you can use a loop for.

  • How to stop the While loop in the Structure of the event with the same button?

    Hello

    I have a problem. I want to use a single control to activate an event in a structure of the event and the same control to end a while loop in this case.

    It is possible to use 2 controls to do this, but I need to be alone.

    Thank you

    You should NEVER place while loops inside the case of the event, and it is never necessary to do. Think about it: all you have to do is spin the code. You can easily use the outside while loop for everything. Simply place the code of the loop internal (without the inner loop) inside the case of delay and manipulate the time-out period between a pending finished and the infinite (-1), depending on the State of the Boolean value.

    A very simple example (LV 8.0)

  • How to end parallel while loops

    Hi, I'm using LV8.5.  I have 2 while loops, running in parallel.  Loop1 is faster (waiting time of 100 ms) and Loop2 is slower (several minutes waiting time).  I use a local variable (STOP button) Boolean to commonality between the loops.  The button is in the loop faster (Loop1) and the local variable is in Loop2.  When I try to end the While loop, Loop1 stops immediately, while I have to wait for Loop2 finish.  Is there a simple way to make two loops to stop immediately?  I have been using a Control\Stop Application, but may not be the right solution.

    Thank you.

    Hi shanx2,

    reduce waiting time in your second loop and count the iterations instead. The loop will do the same, but the stop will react much faster. Another possibility would be to use a queue instead. Connect to a timeout that corresponds to the current time-out period, you use and send a message to stop the loop. You can choose between the queue has been exceeded or not. Connect this result to the conditional loop. You can send the message from the queue after the first loop was arrested.

    Mike

  • How they intend to while loops

    IM an example to count the number of loops of my program did. However, it doesn't seem to work. Ive attached a DBL the i indicator in the while loop of the block diagram. I joined the program below.

    Best regards, Sam

    While the loop counter starts at zero, so if you want to know the numebr of iterations of the loop, you need to add 1 to the loop counter.

    Your loop will work also only once, if the STOP button is not pressed, since you have time condifitional called loop terminal to to continue if true.  If you press the button before running the code, it won't work twice, because you have the Boolean value set to lock, so when the loop reads the Boolean value, it will return false and stop the loop.

    I think that you want to change the conditional terminal back to interrupt if true.

  • How to continue with the loop without breaking?

    Hi people,
    I wrote a simple procedure as follows
      create or replace procedure ploop is
     vsno number;
     vsal number;
     i number:=1;
      begin
     loop
      select sno,sal into vsno,vsal from x
     where sno=i;
      dbms_output.put_line(vsno||vsal);
     i:=i+1;
    exit when i>10;
     end loop;
     end;
    
    so at execution it gives me o/p as
    SQL>  exec ploop;
    11000
    22000
    33000
    44000
    55000
    66000
    77000
    88000
    99000
    1010000
    but now suppose if I delete a record in the table X.for example sno = 6 and then if I run the above procedure, then o/p appears in the form
    SQL> exec ploop;
    11000
    22000
    33000
    44000
    55000
    BEGIN ploop; END;
    
    *
    ERROR at line 1:
    ORA-01403: no data found
    ORA-06512: at "VIDS.PLOOP", line 16
    ORA-01403: no data found
    ORA-06512: at line 1
    So what I need is that I need the loop should be continued without breaking and should display the o/p except the lack records.can u help me pls.?


    Regarding
    VIDS

    try adding the exception like this

    create or replace procedure ploop is
     vsno number;
     vsal number;
     i number:=1;
      begin
     loop
    begin
      select sno,sal into vsno,vsal from x
     where sno=i;
      dbms_output.put_line(vsno||vsal);
    exception when no_data_found then
      null;
    end;
     i:=i+1;
    exit when i>10;
     end loop;
     end;
    
  • How to synchronize parallel while loops?


    This will do what you want?

  • To use or not to use: while loop?

    Being relatively new to LabVIEW and excited by the event programming Structure makes me think that a While loop should almost never be used.

    A While loop uses "polling" to see if a condition is fulfilled or not before you stop the execution, which eats memory. (No pun intended) while event Structures

    don't constantly gobble up CPU memory and waiting for something to happen, and then runs.

    Can someone give me a simple and good example of when it is appropriate to use a While loop? Do not hesitate to talk about certain situations more complicated, requiring a While loop

    which cannot really be addressed with the programming of the Structure of the event.

    While loops and structures of the event go hand in hand. You almost always want to place the structure of the event within a while loop. If you do not you will serve a single event. The while loop will allow you to repair all the events. It is important to note that when there is no event loop will not be doing anything. He will be inactive and essentially no time consume CPU. The structure of the event will have to wait for the next event.

  • structure of the event + while loop

    Hello, I am trying to understand how to unite two while loops in attached VI for half a day

    The first loop creates a state machine solid which reacts on each key and runs one of the structure cases. (that part works very well)

    The second loop, always generates the random number, but it stops the generation during the time where one of the structure cases events are executed. (this is the part ticky)

    Any suggestions?

    If you want your random number to stop so that the user triggered events are running, you should be able to simplify your design a lot.

    It can be done with a loop using the case of timeout.

  • Using asynchronous calls in a while loop. How 'Skip' node and only retrieve data as it is treated

    Maybe I'm not understand asynchronous calls... but I thought I should be able to call one another VI and essentially 'jump' it is the node and only receive data as the called VI treats.  In other words, similar to the Run of VI, I can wire a wait until done? with a fake and the main VI will not wait for the other VI end of race.  The main VI continues to function, and when it passes the called node of the VI, it will receive data if it happens to be there.

    How can I call a VI in a while loop and do not wait so he could spit out the results?  Data flow is my enemy on this one...

    The first VI treats its own figures (using the iteration count) and displays them on the PC.  Other indicators are the data of the called VI.  I want to be able to work around the blue circle node and receive data only that it will be available.

    Any help is appreciated.  Thank you.

    What I said OR the 'Start asynchronous call' is the preferred method for starting background tasks. This call is usually used to run background tasks. For example, you have a process of journal. When your application starts it would use the "asynchronous call Start" to start the process of journal and then move on to the other stuf. The process of the journal would then happily run in the background and the main application is free to do other things. Of course when implementing these types of systems you need a way to coordinate things like exit. This is where the queues and stuff come it.

Maybe you are looking for