For loop, possible to increment counter/exit loop?

I would like to know if it is possible to exit a For loop. I know
I can use a while loop but it would be nice to be able to
increment the loop counter in a for loop. Is this possible?
Thanks,
Mike

Jim,
OK, that clears it up. Coming from VB I'm still figuring out the
differences.
Thanks,
Mike
James Morrison/Joan Lester wrote:
>
> Also remember you can make while loops auto index. Right pop on the tunnel
> and enable this and the loop will then act more like a for loop.
>
> Jim
>
> "Kevin B. Kent" wrote:
>
> > Mike Scirocco wrote:
> >
> > > I would like to know if it is possible to exit a For loop. I know
> > > I can use a while loop but it would be nice to be able to
> > > increment the loop counter in a for loop. Is this possible?
> > >
> > > Thanks,
> > > Mike
> >
> > No sorry it is not possible.
> > If you need this kind of functionality you will have to use a while loop.
> > You can then setup all manner of conditions to exit the lo
op.
> > Be aware that the loop will always run at least ONCE.
> >
> > A for loop will run X number of times. This is determined either
> > at compile time (if the count is hard coded) or at run time
> > (if you use auto-indexing, or the count is a variable).
> >
> > Kevin Kent

Similar Messages

  • How to terminate or exit a for loop when the user clicks on stop button

    Actually my problem is to stop a loop when i click on stop button.
    example:i have two buttons 'start' and 'stop'
    in start buttom i wrote a for loop as
    dim i as integer
    For i=1 To 100000
    print i
    Next
    when i click on start buuton it prints 'i' value up tp 100000.
    my question is when i click on 'Stop' button the for loop has to terminate or Exit from the  loop and should stops the execution.
    Is it possible to termianate or Exit the 'for loop'
    PS.Shakeer Hussain
    Hyderabad

    I am unable to stop the loop and application not at all allowing to Press the Stop button.
    It seems like Hung, any advise ?
    Private Sub btnStart_Click(sender As Object, e As EventArgs) Handles btnStart.Click
            btnStop.Enabled = True
            btnSelectFile.Enabled = False
            btnStart.Enabled = False
            btnStop.Focus()
            Dim strFileName As String = txtFileName.Text.ToString
            Dim strLineText As String
            If System.IO.File.Exists(strFileName) = True Then
                Dim objReader As New System.IO.StreamReader(strFileName)
                While objReader.Peek() <> -1 And stopclick = False
                    strLineText = objReader.ReadLine()
                    MsgBox(strLineText, MsgBoxStyle.Information)
                    Application.DoEvents()
                    Thread.Sleep(My.Settings("strDelay") * 1000)
                    'System.Diagnostics.Process.Start(My.Settings("strFireFoxLocation"), strLineText)
                End While
            End If
        End Sub
        Private Sub btnStop_Click(sender As Object, e As EventArgs) Handles btnStop.Click
            stopclick = True
            btnSelectFile.Enabled = True
            btnStart.Enabled = True
            btnStop.Enabled = False
        End Sub
    Raman Katwal
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

  • How do i configure a FOR loop to have the behavior of the step Loop Type: Pass/Fail count?

    Hello,
    I'm using the Pass/Fail count set to one Pass to capture an event generated by my DUT.  I originally used a numerical compare step with the Looping type of Pass/Fail count to accomplish this.  Unfortunately the implementation changed and now I need to execute a few steps that can not be combined within one code module as before. Nor can these steps be put into a subroutine.  One of the steps executes a .NET asembly and I haven't figured out how to pass the reference to the subroutine.  When the subroutine is intered the reference is lost and the methode does not execute correctly.
    I have an evaluation function the exits the loop when the expected conditions are met. Everything works except for the Overall Pass/Fail result of the For loop.  If the loop exits due to the first numerical compare test passing, I want the loop overall execution to report as "Passed".  If the loop reaches it's predetermined number of iterations, the overall result needs to report as "Failed".  It would also be nice to have the radio button functionality of "Record Result of Each iteration".  Some conditions require a wait over a minute for the event to occur and I don't want to generate needless data for the report.
    Currently I get the pass/fail status for each For loop iteration, but only "Done" for each loop iteration.  I don't want the initial few failures to cause the test to fail.
    Does anyone know how to do this? Suggestions?
    Thanks,

    I have 2 steps in the loop that can not be combined into one step. This forces me to implement the behavior in some form of loop.  A While Loop could be an option.  I would need to pass the Step.Result.Status from the Multiple Numerical compaire step to the condition of the While Loop.  I tried to use the Step.TS.ID without success.  Some form of reference to the numerical compare step would be needed. I'm using a For Loop as I do want to limit the number of iterations of the loop.  In the case where the loop iterations are reached, the event I am trying to detect did not occur at the correct time and a failure needs to be reported.
    I came up with something based on my comments in the second post:
    1) To start with I configured a Locals.ForLoop_5 variable.  This is used to set the limit on the loop iterations and for comparison after the loop has finished executing. More on that later.
    2) The first step inside the loop invokes a method within a .NET assembly that has been packed in a DLL This method gets the required data from the DUT and stores it to a text file.
    3) The next step is the Multiple Numeric Limit step.  This step invokes a VI that extracts the data from the text file.  This step has been customized in several ways.
      i)  In Run Options, the Results Recording Option was disabled.  This prevents recording of "Failed" while the loop executes when waiting for the event to happen.
      ii) In Run Options, the Step Failure Causes Sequence Failure is unchecked.  Same reasoning as i)  These steps are not true failures.
      iii) A Post Action is configured to go to the nexxt step after the For Loop End step On Condition True with the logic of Step.Result.Status == "Passed".  This causes the loop to exit when the first "Passed" is encountered which corrolates with the event I'm trying to detect. On Conditon Fail remains set to default.
    4)  The step after the For Loop End is an expression step with everythin set to default except for the Status Expression logic set to: Locals.Loopindex < Locals.ForLoop_5 ? (Step.Result.Status = "Passed") : (Step.Result.Status = "Failed"). This step performs the overall Pass/Fail reporting for the For Loop.  If the number of loop iterations is less than the maximum it could have only gotten there by the previous logic triggered by the numerical compare passing, therefore "Passed".  If the loop index has reached the limit, then the event was not detected, therefore Failed.
    I have tested this work around with success, it just a pain to now have to implement this on my 40 some odd For Loops.
    If there is a better way, I'd still like to hear it.

  • Resetting a for loop counter and restarting the computation

    I have a while loop nested inside a for loop to do a calculation of a model. 
    Lets say I am on the for loop counter 4. Suppose I wanted to keep track of the number of iterations on one the while loop, and if it exceeded a certain number say 100, exit the while loop.  I am doing this to avoid my model calculation being stuck at a spot due to optimization issues. I now want to restart the calculations of for loop counter 4. 
    Is there a way to do this in labview? 
    Solved!
    Go to Solution.

    Well first of all, if you are going to restart the loop with the same program inside it after it got stuck is it not just going to get stuck again creating a permanent loop in the code? Would you not just want to move on and have some sort of identifier that one of the for-loops got stuck?
    But I would recommend simply nesting your while-loop inside of another while loop, then connect the exit for the out while-loop to some variable from the inner while-loop, so if the optimization did not occur properly then it simply repeats the inner while-loop.
    Although I stick by my thoughts that you will just end up in a permanent loop if the optimization fails the first time.

  • While loop in a for loop,Is it possible?

    Is It possible to call a while loop a particular number of time's using a for loop.
    for example :
    for(.....){
    while(true)
    Is this technically possible?
    Thanks,

    Hans9777 wrote:
    Based on the code you wrote , the program will enter the for loop and then the while loop . It will never exit the while loop as while(true) means loop infinite times. normally while do-while and for loop can be immplemted for the same function therefore they are rarely used together.Obviously his code only showed the loop structures themselves with no loop bodies. Supposedly there may be a 'break' in the while loop somewhere, so it is not necessarily an infinite loop.
    And your remark about them rarely being used together is nonsense. Loops within loops are written for legitimate logic purposes all the time, regardless of what kind of loops they are.

  • How to get count from new enhanced for loop

    Is there a better way to determine the count when new enhanced for loop is used as follows:
    String[] test = new String[]{"1","2","3"};
    int count = 0;
    for(String i: test)
    count++;
    system.out.println("count: "+count);
    }

    There are cases where I need to use the count inside
    the for loop. I can keep track of the count by using
    the increment. But, then I would rather using the old
    for loop. Go ahead and use it. Are you under the assumption that the old form should be avoided?
    There is no saving in term of efficiency and readability.If there is any added efficiency in the "for each" form of the loop, it is on the micro level, and you would never notice it.
    As far as readability, look at some of the crazy solutions you've been given to avoid the general for loop, then reconsider which is more readable.

  • Stopping output tasks properly before exiting a For-loop

    Hi,
    I've been having some trouble exiting a For-loop conditionally. The problem is that when the loop is stopped conditionally (a button is pressed) the DAQ (NI USB 6353) outputs get stuck to whatever value they were in. I tried stopping the DAQ Assistant output task (1 sample on demand)  before exiting the loop but that didn't solve the problem. Should this perhaps be done one iteration before exiting the loop or can it be done in the same iteration round?
    What would be the "right" way to exit a for loop with output tasks so that the output signals would be 0V after exiting? I know that I could "force" feed the DAQ Assistant with 0V control before exiting but in this case that would be quite difficult...
    Any ideas? Help is appriciated.

    Yes, I get it... However at this point I don't think that's an option.
    Would this kind of solution work? ( I am not able to test all possible solutions in the real system which is why I would like to get a confirmation first)
    The idea is to connect the output of the "Or" port to the "Stop" -ports of the DAQ Assistants in the loop.
    Edit. Will the output automatically go to 0V if I just stop the task? I am not really sure about this.
    Thank you.
    Attachments:
    exit-loop.jpg ‏8 KB

  • Creating an array in a 'for' loop (resetting loop count)

    Hi,
    I am trying to integrate an acceleration signal coming from a CRIO analogue input to obtain the speed and then further integrate to get the displacement of a vibration system.
    I understand that in order to perform the integration, an array has to be fed in. My problem is that I could not buffer the signal in a buffer block as I couldn't find any buffer blocks. so I decided to create my an array of data using a 'for' loop. The 'for' loop nests inside a timed loop. The problem that I got stuck at is how to reset the 'for' loop in order to refill the buffer again at every iteration of the outer timed loop.
    I have attached the code if that helps. Note that I am using labview 2013.
    I would be gratefull if someone who had encountered a similar issue before can help me.
    Regards
    Ali
    Solved!
    Go to Solution.
    Attachments:
    acc_test.vi ‏42 KB

    Dear Altenbach,
    Many thanks for your reply.
    I need to make it clear that I have not had enough hands-on with labview, I have only used it for sometime in the past and now I have to in order to perform some active damping on a 50Hz running machine. I must stress the fact that what i find more intuitive to do in a different programming language (matlab or C) is not as straightforward in labview. so please bear with me if my code has basic mistakes .
    All what i am trying to do is obtain the speed and position from an acclerometer signal. unfortunately i dont have a position sensor so i have to measure acceleration then perform time integrations in order to obtain the speed and position respectively. I am using a compact Rio (later in FPGA mode) to take physical measurements of acceleration from the vibratory machine and where i managed to do this bit successfully. when it came to performing the integration, i had to create an array inside my timed loop since i couldn't find a buffer block. I implemented a 'for' loop inside a timed loop in order to build the array. however i got stuck at resetting the count of the 'for' loop in order to refill the array with new values at every new iteration of the outer timed loop. unfortunately, even a sensible answer has been suggested before, i dont seem to have been capable of doing it yet. I really spent all my day trying to figure a way out but not achieved it yet, nevertheless I have learnt many many things by playing around.
    I would be gratefull if you could comment on a possible way of doing what i am trying to do.
    Kind Regards
    Ali

  • For Loop exits prematurel​y - Arrays and Shift Registers

    I have attached some preliminary code (work in progress) for the RC4 encryption algorithm. For some reason the middle for loop exits prematurely. In other words it exits after 2 iterations instead of the 256 iterations that N is set to.
    I thought this was not possible and therefore I am presuming I have made some not so obvious error in attempting to use a shift register with an array.
    Please have a look. Thanks.
    Attachments:
    RC4 Encryption beta.vi ‏78 KB

    You misunderstand how a for loop operates. You can either wire a number to the N terminal or you can wire an array into it with auto-indexing turned on. With an array input, the for loop will iterate equal to the size of the array. When you wire both (a practice I do not recomend), the for loop will iterate to whichever is smaller - the array size or the N terminal. Both of your for loops on the left side is creating arrays with only two elements. I suspect that what you need in both of them is a shift register instead of exiting the for loop with auto-indexing turned off.

  • The demand of my application is that i can not replace for loop with a while loop.because i need fixed number of iterations and as far as i know fixed iterations could be only with possible with the for loop.

    the demand of my application is that i can not replace for loop with a while loop.because i need fixed number of iterations and as far as i know fixed iterations could be only with possible with the for loop.
    your recommended second option that i could add true/false case.
    this true/false case must be inside the for loop or outside the for loop?if this case is inside the for
    loop, how can i send stop command from outer while
    loop?
    more over do you have any example for this please?
    thanks"

    You can execute a fixed number of iterations using a while loop by comparing the iteration count to the number of iterations you want and wiring the output of that comparison (e.g. Less Than or Equal To) to the continue (or stop) terminal of your while loop. Which comparison you use depends on personal preference, where you wire the desired count and the interation count, and whether you're using the while loop as Continue if True or Stop if True.
    Ben gave you step-by-step instructions in response to your previous question. Look here for Ben's response.
    Ben's response looks pretty good and detailed to me. It certa
    inly deserved better than a 1-star rating.

  • Question to modify a for loop to put a counter and parametrize it

    I have a FOR loop which is part of a PROCEDURE, the loop currently commits records for a large group of network providers. I need to modify it put a counter and commit for every 100 rows and make the number of rows of 100 parametrized. Any idea how this can be accomplished?
    FOR cur_netrec IN cur_network_mc (curproc.mpicontractid)
                LOOP
                   v_effectivedate := NULL;
                   v_terminationdate := NULL;
                   v_delegated := 'N';
                   v_individual := 'N';
                   v_credential := NULL;
                   FOR cur_conrec
                   IN cur_cont (cur_netrec.providerid, cur_netrec.mpinetworkcode)
                   LOOP
                      IF cur_conrec.effdate IS NOT NULL
                      THEN
                         v_effectivedate :=
                            LEAST (cur_conrec.effdate,
                                   NVL (v_effectivedate, '31-DEC-9999'));
                      END IF;
                   END LOOP;
                   IF cur_netrec.mpinetworkproviderid IS NULL
                   THEN
                      INSERT INTO mpi_provider.mpinetworkprovider (
                                                                      mpinetworkproviderid,
                                                                      providerid,
                                                                      mpinetworkcode,
                                                                      providernetworkcode,
                                                                      effectivedate,
                                                                      terminationdate,
                                                                      credentialingtypecode,
                                                                      createdby,
                                                                      creationdate,
                                                                      modifiedby,
                                                                      modificationdate
                        VALUES   (
                                     seq_mpinetworkprovider.NEXTVAL,
                                     cur_netrec.providerid,
                                     cur_netrec.mpinetworkcode,
                                     (SELECT   otherid
                                        FROM   mpi_provider.mpiprovider
                                       WHERE   providerid = cur_netrec.providerid),
                                     NVL (cur_netrec.effectivedateoverride,
                                          v_effectivedate),
                                     NVL (cur_netrec.terminationdateoverride,
                                          v_terminationdate),
                                     v_credential,
                                     USER,
                                     TRUNC (SYSDATE),
                                     USER,
                                     TRUNC (SYSDATE)
                   ELSE
                      UPDATE   mpinetworkprovider
                         SET   effectivedate =
                                  NVL (cur_netrec.effectivedateoverride,
                                       v_effectivedate),
                               terminationdate =
                                  NVL (cur_netrec.terminationdateoverride,
                                       v_terminationdate),
                               credentialingtypecode = v_credential,
                               modificationdate = TRUNC (SYSDATE),
                               modifiedby = USER
                       WHERE   providerid = cur_netrec.providerid
                               AND mpinetworkcode = cur_netrec.mpinetworkcode;
                   END IF;
                   --update when contract credential type code change
                   UPDATE   mpi_provider.person prs
                      SET   prs.credentialingtypecode =
                               (SELECT   DECODE (MIN (credtype),
                                                 1, 'DELEGNCQA',
                                                 2, 'DELEGNETEX',
                                                 3, 'DELEGATED',
                                                 4, 'NONDELEG',
                                                 5, 'INDIVIDUAL',
                                                 6, 'NONDENETEX',
                                                 'NONE')
                                            AS personcredentialingtypecode
                                  FROM   (SELECT   DECODE (
                                                      c.credentialingtypecode,
                                                      'DELEGNCQA',
                                                      1,
                                                      'DELEGNETEX',
                                                      2,
                                                      'DELEGATED',
                                                      3,
                                                      'NONDELEG',
                                                      4,
                                                      'INDIVIDUAL',
                                                      5,
                                                      'NONDENETEX',
                                                      6,
                                                      7
                                                      AS credtype
                                            FROM   mpi_provider.mpicontractprovider cp,
                                                   mpi_provider.mpicontract c
                                           WHERE   c.mpicontractid =
                                                      cp.mpicontractid
                                                   AND cp.providerid =
                                                         cur_netrec.providerid
                                                   AND cp.terminationdate >
                                                         SYSDATE))
                    WHERE   prs.providerid = cur_netrec.providerid;
                   COMMIT;          
                END LOOP;

    This piece could be accomplished with a MERGE, too
                   IF cur_netrec.mpinetworkproviderid IS NULL
                   THEN
                      INSERT INTO mpi_provider.mpinetworkprovider (
                                                                      mpinetworkproviderid,
                                                                      providerid,
                                                                      mpinetworkcode,
                                                                      providernetworkcode,
                                                                      effectivedate,
                                                                      terminationdate,
                                                                      credentialingtypecode,
                                                                      createdby,
                                                                      creationdate,
                                                                      modifiedby,
                                                                      modificationdate
                        VALUES   (
                                     seq_mpinetworkprovider.NEXTVAL,
                                     cur_netrec.providerid,
                                     cur_netrec.mpinetworkcode,
                                     (SELECT   otherid
                                        FROM   mpi_provider.mpiprovider
                                       WHERE   providerid = cur_netrec.providerid),
                                     NVL (cur_netrec.effectivedateoverride,
                                          v_effectivedate),
                                     NVL (cur_netrec.terminationdateoverride,
                                          v_terminationdate),
                                     v_credential,
                                     USER,
                                     TRUNC (SYSDATE),
                                     USER,
                                     TRUNC (SYSDATE)
                   ELSE
                      UPDATE   mpinetworkprovider
                         SET   effectivedate =
                                  NVL (cur_netrec.effectivedateoverride,
                                       v_effectivedate),
                               terminationdate =
                                  NVL (cur_netrec.terminationdateoverride,
                                       v_terminationdate),
                               credentialingtypecode = v_credential,
                               modificationdate = TRUNC (SYSDATE),
                               modifiedby = USER
                       WHERE   providerid = cur_netrec.providerid
                               AND mpinetworkcode = cur_netrec.mpinetworkcode;
                   END IF;
                   --update when contract credential type code change
                   UPDATE   mpi_provider.person prs
                      SET   prs.credentialingtypecode =
                               (SELECT   DECODE (MIN (credtype),
                                                 1, 'DELEGNCQA',
                                                 2, 'DELEGNETEX',
                                                 3, 'DELEGATED',
                                                 4, 'NONDELEG',
                                                 5, 'INDIVIDUAL',
                                                 6, 'NONDENETEX',
                                                 'NONE')
                                            AS personcredentialingtypecode
                                  FROM   (SELECT   DECODE (
                                                      c.credentialingtypecode,
                                                      'DELEGNCQA',
                                                      1,
                                                      'DELEGNETEX',
                                                      2,
                                                      'DELEGATED',
                                                      3,
                                                      'NONDELEG',
                                                      4,
                                                      'INDIVIDUAL',
                                                      5,
                                                      'NONDENETEX',
                                                      6,
                                                      7
                                                      AS credtype
                                            FROM   mpi_provider.mpicontractprovider cp,
                                                   mpi_provider.mpicontract c
                                           WHERE   c.mpicontractid =
                                                      cp.mpicontractid
                                                   AND cp.providerid =
                                                         cur_netrec.providerid
                                                   AND cp.terminationdate >
                                                         SYSDATE))
                    WHERE   prs.providerid = cur_netrec.providerid;

  • LabVIEW 6.1 If For Loop count terminal is zero then value going through the loop is not passed on to the output of the loop

    Hello, one of our customers just encountered an execution error in a vi running under LabVIEW 6.1, which doesn't exist under LabVIEW 5.1 or 6.01. I have a simple vi that has two encapsulated For Loops. Two string arrays go in, one goes out of the outer loop. Inside the outer loop the first array is indexed. The string which results from this indexing is compared with all other strings from the second string array in the inner loop. If it matches one of the strings of the second array, it is not outputted, otherwise this string goes through the inner For Loop to the output of the inner loop and from there to the output of the outer loop. The count
    terminal of the outer/inner loop is connected to the Array Size of the first/second string array. If the second array is empty, that means that the element in test from the first arry cannot match anything from the second array, so the element in test is send to the output of the inner loop and from there to the output of the outer loop. This works fine in LabVIEW 5.1 and 6.01, but NOT in LabVIEW 6.1. In LabVIEW 6.1 the inner loop is never executed if the count value is zero (which is correct), but the data line running through the loop is not executed either, which is different to what LabVIEW 5.1 and 6.01 do. There, the input string is sent to the output of the inner loop correctly even if the loop counter is zero. The solution is easy - I just have to connect the output of the outer loop to the data line BEFORE it enters the inner loop. But: I don't know if this is a LabVIEW 6.1 bug or if it is supposed to be a feature, but it brings some incompatibility in programming between the
    different LabVIEW versions.
    Best regards,
    Gabsi

    Hi,
    When a for-loop runs zero times, all outputs are 'undefined' (and should
    be).
    Besides, how would LV know what the output of a not executed routine should
    be?
    It might be handled differently in LV5 and LV6, which is unfortunate. In
    both cases, the result is undefined.
    It's not a bug. It's just something that should be avoided in any LV
    version.
    > The solution is easy - I just have to connect the
    > output of the outer loop to the data line BEFORE it enters the inner
    > loop. But: I don't know if this is a LabVIEW 6.1 bug or if it is
    In some cases this does the trick. But if the data is changed in the inner
    loop, this will effect the results if the N is not zero.
    Technically, I think the output in this construction is also 'undefined'.
    But LV handles this as expected / desired.
    Another solution is to use a shift register. If N is zero, the input is
    directly passed through to the output.
    Regards,
    Wiebe.
    "Gabs" wrote in message
    news:[email protected]...
    > LabVIEW 6.1 If For Loop count terminal is zero then value going
    > through the loop is not passed on to the output of the loop
    >
    > Hello, one of our customers just encountered an execution error in a
    > vi running under LabVIEW 6.1, which doesn't exist under LabVIEW 5.1 or
    > 6.01. I have a simple vi that has two encapsulated For Loops. Two
    > string arrays go in, one goes out of the outer loop. Inside the outer
    > loop the first array is indexed. The string which results from this
    > indexing is compared with all other strings from the second string
    > array in the inner loop. If it matches one of the strings of the
    > second array, it is not outputted, otherwise this string goes through
    > the inner For Loop to the output of the inner loop and from there to
    > the output of the outer loop. The count terminal of the outer/inner
    > loop is connected to the Array Size of the first/second string array.
    > If the second array is empty, that means that the element in test from
    > the first arry cannot match anything from the second array, so the
    > element in test is send to the output of the inner loop and from there
    > to the output of the outer loop. This works fine in LabVIEW 5.1 and
    > 6.01, but NOT in LabVIEW 6.1. In LabVIEW 6.1 the inner loop is never
    > executed if the count value is zero (which is correct), but the data
    > line running through the loop is not executed either, which is
    > different to what LabVIEW 5.1 and 6.01 do. There, the input string is
    > sent to the output of the inner loop correctly even if the loop
    > counter is zero. The solution is easy - I just have to connect the
    > output of the outer loop to the data line BEFORE it enters the inner
    > loop. But: I don't know if this is a LabVIEW 6.1 bug or if it is
    > supposed to be a feature, but it brings some incompatibility in
    > programming between the different LabVIEW versions.
    > Best regards,
    > Gabsi

  • Error -200429 DAQmx read (counter u32 1ch 1samp).vi -append- Edge count in for loop

    I am receiving error -200429 DAQmx read (counter u32 1ch 1 samp).vi <append>. This is occuring on the second loop of a for loop.
    I have a sequence inside the for loop that is using four DAQmx assistant vi's for edge count at various times in the sequence. All four of these count fine the first time through but at the beginning of the second loop the first edge count receives this error and does not count.
    Any ideas?

    The code you have supplied is similar to the converted subvi but this code will give an empty task error on the DAQmx Create Channel vi.
    Notice on the Daqmx create task vi that there is nothing wired to the "Task to copy" or the "Global virtual channels" connectors - I believe this is why the task is empty when sent to the Daqmx create channel vi.
    The code we are currently using is a modification of a previous code used before a recent upgrade. It may be better in your/NI eyes to re-write this into a State machine but time constraints and resources do not allow that at this time - All other parts of the current program work except for the counter on the second iteration. Would rather not reinvent the wheel at this point. 
    If the task is being cleared was the issue then the other three should also not execute. The issue appears to be the "First Call"
    I have attached a zip file of the complete program as it is now written to give you a better idea of the whole picture.
    Attachments:
    Test Machine current code.zip ‏657 KB

  • How to maintain counter in a for loop

    Hi, 
      How do we track counter in a loop?Isn't it the way I implemented.? Please suggest.
    Regards.
    Solved!
    Go to Solution.
    Attachments:
    for loop counter.jpg ‏219 KB

    Both loops have errors, if you try to do for(i=60;i<120;i++) you're only running 60 loops, not 120.
    You should also disable the autoindexing on incoming arrays as you want some split array indexes (actually you can optimize it by extracting the constant a[30] before the 1st loop and the opposite on the 2nd. Now you're extracting 2 numbers from a 1D array instead of 1 from a 2D array ...
    The number on the select/sum function should be integers, no need to calculate doubles.
    The small array to sum it up is only max 170 numbers, it's ok although a sum in a shift register would be better.
    /Y
    LabVIEW 8.2 - 2014
    "Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
    G# - Free award winning reference based OOP for LV

  • For Loop Exit

    Hi there, i am writing a program that requires a break in the for loop. However, I am using Labview 7.1, and it doesnt have a conditional exit. If anyone can give me some suggestions, I would appreciated it. 
    Derek
    Solved!
    Go to Solution.

    You do not have to include the upper test in your loop. If you use the auto-indexing you get that for free. The while loop will run as many iterations as there are array elements (provided whatever other conditions you test to stop the loop are not met).
    The one thing to be aware of though is if you connect more that one array the number of iterations run will be equal to the size of the smallest array. If you have an empty array the loop will not run.
    Mark Yedinak
    "Does anyone know where the love of God goes when the waves turn the minutes to hours?"
    Wreck of the Edmund Fitzgerald - Gordon Lightfoot

Maybe you are looking for

  • How can I print out a document on an '05 version of iLife (iWorkPages)  es)

    How can I print out a document on an '05 version of iLife that includes iWork? I want to make a document in Pages and print it. It tells me that I have to buy Pages, but doesn't tell me where to go to do that.

  • IPod Touch 3 bluetooth connection to wireless Motorola HT820 headphones

    YouTube - iPod Touch 3 upgrade using bluetooth to connect Motorola HT820 wireless headphones. The iPod Touch bluetooth is working. http://bit.ly/14LNy5

  • Vendor range in SRM

    Hi experts i've imported by bbpgetvd some vendors from ECC 6.0 to SRM 5.0 but some are wronged. I've deleted the needed by ppoma_bbp but i'd like to know if there is a way to go back with the number range of vendors i think abou trans SNUM.... regard

  • Rename files in Terminal using mv and sed

    I want to rename multiple files (in one directory) using mv and sed in Terminal (Mac OS 10.6.8). I want to change each and every file name from IMG_nnnn.jpg to HVAC_nnnn.jpg, where nnnn is the camera's sequence number. I want to preserve the sequence

  • Retina MacBook Pro Flickering

    I had my screen replaced because I had the image retention issue that most LG screens had. Ever since I got it replaced my screen will flicker randomly. I got some video of it and hope they will replace it. What is your experience with this isssue? (