by the way the variable counter between the loops

I have a question about the passage of a variable counter between different events / while loops and seen an increase in value regardless of the loop is initiated.

The fundamental problem is that I write file names unique to data collected on a spectrometer, and I would value at the end of the name of the file to increment every time that I collect the data. There are several different ways that I can collect the data, and I'd like the counter to increment when the collections is triggered. The attachment shows essentially what I'm trying to accomplish. Represent it buttons collect two different types of data I collect my instrument, but the counter variable is not passed correctly between the two loops. Is it possible that I can get the incrementing counter so that the two loops read the same value of counter?

Thanks for your help.

MICAH

I can't look at your code since I'm on a phone. But you should really only have / need a structure of the event in a vi. The only exception I can think of is one to manage the events of the user and the other for GUI events. But even in this case there is no reason that I can think to need two.

Tags: NI Software

Similar Questions

  • Passing an associated variable number between 'for' loops and functions?

    Hello

    I seem to have a problem with the information how variables can be passed between functions and tables.

    I have variable 'capture' put in place as a number.

    grab var: number;

    My intention (I'll do my best to explain) must have a number 'attached' to catch when it is mentioned for the first time in this function, itemClick.

    These must be all relevant tables:

    clickItemArray = [scene_Camp.wood, scene_Ax.ax]

    itemUsableArray = [wood2, ax2]

    ...

    sceneGuyArray = [scene_Camp.guy_Camp, scene_Ax.guy_Ax]

    function itemClick(event:MouseEvent) {}

    for (grab = 0; enter < clickItemArray.length; grab ++) {}

    If (clickItemArray [type] .hitTestPoint (mouseX, mouseY, true)) {}

    addEventListener (Event.ENTER_FRAME, itemRemoval);

    sceneGuyArray [grab] .gotoAndPlay ("guy_Notice");

    trace ("guy_Notice");

    }

    }

    }

    I would like to have the number in place with grab (it would be a 0 or 1, clickItemArray, sceneGuyArray and itemUsableArray) can be passed on to the next function, itemRemoval. I was hoping to use variables I can use the same function for some point clicked on. For example, if the clickItemArray was point 1 (the axe), then sceneGuyArray [Enter] would be = 1, and would play the right frame. Number 1 would be transferred to the itemRemoval function, where he would constantly be listening to sceneGuyArray [1] also (where '1' would have been obtained through the initial 'grab' in the first function) and react accordingly.

    function itemRemoval(event:Event) {}

    for (var grab2:uint = grab; grab2 < sceneGuyArray.length; grab2 ++) {}

    If (sceneGuyArray [grab2] .currentLabel == 'guy_NoticeDone') {}

    removeEventListener (Event.ENTER_FRAME, itemRemoval);

    trace ("cheese");

    }

    }

    }

    I can't get the track works well. I don't know I'm doing something wrong with 'for' loops or the stated case.

    Naturally, help would be appreciated.

    then, in itemClick(), use:

    Grab = itemClickArray.IndexOf (Event.currentTarget)

  • Using variables shared between the different versions of labview

    Hello

    I look at the use of variables shared between two different versions of LabVIEW. We have a 2 of the PXI system and a single PC. We are currently updating the code on the PXI system to 2014, but the PC still work 8.2.1. We now need a map of ARINC-429, which is executed only 2009 +, that is why we are to day. First tests show that shared variables do not communicate between the two. I think that the reason may be that the PXI running the version of variable motor 2014 shared, while the PC is running 8.2.1, but I don't know if it is precisely for this reason it does not work. Is there a way to communicate between two different versions of LabVIEW with shared Variables?

    Thank you!

    SOLUTION

    There are two key elements in the process of installing software that are essential for PXI to communicate with another version of LabVIEW: Legacy Server Support Variable and Variable Support of Legacy Protocol. The first, in charge of the Protocol, was automatically installed through the selection of the other ingredients (although I do not know which triggered its installation). The second has been nested in the Protocol, but was not selected automatically.

    The Protocol allows the PXI 2014 connect to shared variables hosted by devices 8.6 or an earlier versions, while the server allows before 2009 devices to communicate to shared variables hosted on PXI of 2014 (which was the initial problem)!

  • When I create two keyframes at the same position between keyframes at different positions this way adds a loop. How can I get rid of the loop?

    When I create two keyframes at the same position between keyframes at different positions this way adds a loop. How can I get rid of the loop? I was just by dragging the handles on the vertex point, but I want to get rid of the loop together.

    Focus on the Bezier handles on the motion path in the Composition window. You can select the tool pen (g) and hold down the Alt/Option key to select the tool convert Vertex (it looks like a V on the side) and then fix the handle manually or click on the top of the trajectory to change it to a straight line. You can also play with spatial interpretation Keyframe.

    To avoid this, you can change the interpolation of keyframes in space to linear preferences. Most of the time I don't like straight so I keep my default value of Bézier.

  • VISA resources between the loops with the queue

    Hi all

    I am just be familiar with the queues and the producer/consumer model, and I am facing difficulties to pass data between the loops using queues, including data of the type "VISA Resource Name.

    Indeed, it seems impossible to cable "VISA Resource Name" as an entry of the item in the queue, as an output of the Dequeue item.

    These screws can I always try to convert something of this type can accept? Or should I take a different approach and that one?

    Thank you very much for your help.

    Florian


  • An associative array, how the records using the loop counter?

    In the associative array, how the records using the loop counter? for example
    declare
        type population is table of number index by varchar2(64);
        city_population population;   
    begin
        city_population('Samillve') := 200;
        city_population('Lindenhurst') := 300;    
        
        for i in 1 .. city_population.count
        loop
            dbms_output.put_line(city_population(i)); -- compiler error
        end loop;
    end;
    /

    That would look like

    SQL> ed
    Wrote file afiedt.buf
    
      1  declare
      2      type population is table of number index by varchar2(64);
      3      city_population population;
      4      l_index varchar2(64);
      5  begin
      6      city_population('Samillve') := 200;
      7      city_population('Lindenhurst') := 300;
      8      l_index := city_population.first;
      9      while( l_index IS NOT NULL )
     10      loop
     11          dbms_output.put_line(city_population(l_index ));
     12          l_index := city_population.next(l_index);
     13      end loop;
     14* end;
    SQL> /
    300
    200
    
    PL/SQL procedure successfully completed.
    

    Justin

  • Declare the variable in the loop or abroad?

    What is the smartest, if the statement is a loop much like 100000. Is there a difference?

    * for(int i = 0; i < 100000; i++) {*}
    Dim myStr = getSomething();
    *}*

    or

    Dim myStr = "";
    * for(int i = 0; i < 100000; i++) {*}
    myStr = getSomething();
    *}*

    No, there is no performance difference (that's what you thought, weren't you).

    The basic rule by declaring variables is "the smallest scope possible. So in this case inside the loop for.

  • Put the loop of variables in a single table with formatting (PHP)

    I have the following loop;

    <? PHP

    $i = 1;

    While ($i < = $num_rows)

    {

    $tempquantity = "extra". $i.' quantity ';

    $tempcomments = "extra". $i."comments";

    $tempname = "extra". $i.' name ';

    $tempprice = "extra". $i."price";

    $$tempquantity = $_POST ['extra'. $i. "quantity"];

    $$tempcomments = $_POST ['extra'. $i. "Comments"];

    $$tempname = $_POST ['extra'. $i. "name"];

    $$tempprice = $_POST ['extra'. $i. 'price'];

    Print "Extra name: $$tempname;

    Print "< br / > ';

    Print "Extra price:". "." $$tempprice;

    Print "< br / > ';

    Print "quantity:". "." $$tempquantity;

    Print "< br / > ';

    Print "reviews:". "." $$tempcomments;

    Print "< br / > < br / > ';

    $i++;

    }

    ? >

    Which, since there are 3 rows, outputs the following:

    Extra-Nom: dfvgfddf

    Extra price: 4

    Quantity required: 67

    Customer reviews: gtfh


    Extra-Nom: wewew

    Extra price: 34

    Required quantity: 45

    Customer feedback: thtrt


    Extra name: ewewe

    Extra price: 43

    Required quantity: 12

    Customer feedback: gdfgg

    I want to be able to do is to show the output above in a PHP email body variable which, according to me, this means that the loop variables must be in a single array variable as coding in a body of email variable is not allowed. How can I put a loop of variables like that in a single variable, and how to keep the < br / > tags and names before variables ("name Extra:' etc."), so it seems that it should in the PHP email body?

    Thanks in advance

    I also need to set the variables generated by the loop in a single database field

    Why?  Looks like a mistake to me.

    Anyway, why not change it.



    The name of the tenant: $rentername

    on this subject.



    " The tenant's name: $rentername.

    $i = 1;

    While ($i<>

    {

    $tempquantity = "extra". $i.' quantity ';

    $tempcomments = "extra". $i."comments";

    $tempname = "extra". $i.' name ';

    $tempprice = "extra". $i."price";

    $$tempquantity = $_POST ['extra'. $i. "quantity"];

    $$tempcomments = $_POST ['extra'. $i. "Comments"];

    $$tempname = $_POST ['extra'. $i. "name"];

    $$tempprice = $_POST ['extra'. $i. 'price'];

    $body. =<>

    Additional name: $$tempname

    Extra charge: $$tempprice

    Required amount: $$tempquantity

    Customer reviews: $$tempcomments

    EOT;

    $i++;

    }

    and then remove the loop where it occurs earlier.

  • Variable to URL in the list of the loop

    I have a query in a loop that should receive a value of a url string, but I don't know how to reference the string variable in the loop. I get an error with my method.

    ? P1 = open

    ? P2 = open

    ? P3 = open

    etc etc.

    I have to loop through my query < cfloop from = "1" to = "#menu. ' RecordCount # ' index 'i' = >

    but, I want to place the url variable in the loop as well

    < ul rel = "#URL.p [i] #" > <!-it gives me an error.--> I can do this < ul rel = "#URL.p1 #" > and it works, but I need for the feature based on p1, p2, p3 etc. ""

    How could refer to this variable in a loop?


    #URL.p [i] #.

    Almost.  If your url variables are named p1, p2, etc, the syntax is:

    #URL [' p #i # '] #... OR

    #URL ['p' & I] #.

  • How to make a loop with variable values depending on where you are in the loop

    Hello

    I need loops / nested loops that choose different figures depending on where you are in the loop.

    The entire function must operate at times 'ml '. 'ml' is a dynamic figure.

    Loop 1 = while the loop is the first 12 iterations, "exconemp" must be equal to 100. 13-24 iterations, 'exconemp' to 102.5 equal, for 25-36 TI 105.06, 37-48, it will be 107.69. This must change each 12th iteration until he reached 'ml '. The calculation takes the value of the previous 'exconemp' and then that multiply by 0.025.

    Loop 2 = while the loop is in 120 first iterations, 'abc' should be equal to 0.015 and additional iterations should use 0.01. It should also work in a way to know if 'ml' is greater or less than 120 and work accordingly.

    My main problem is - this - how can I get loops to go like this:

    While the iteration is < 12, to do this, THEN take the final figure (12th iteration) and begin the 13-24, make this SO etc etc.

    How to produce a THEN statement? I can get the code to pick up the final values, but does not change along the way.

    I think I might better create an array for loop 1, but I'm not entirely convinced of that. Also, I think it would be better/more net if I can get "month total 1 ' and ' month 2 total ' in loops, but do not know how to do this.

    The values I need to produce (only 36 first shown):

    1-12 = 125.55, 251,65, 378.31, 505.52, 633.29, 761.63, 890.53, 1019.99, 1150.03, 1280.63, 1411.81, 1543.57
    13-24 = 1679.05, 1815.12, 1951.79, 2089.06, 2226.93, 2365.41, 2504.50, 2644.20, 2784.52, 2925.45, 3067.00, 3209.18
    25-36 = 3355.19, 3501.85, 3649.15, 3797.11, 3945.71, 4094.96, 4244.87, 4395.44, 4546.68, 4698.57, 4851.14, 5004.38

    var ml = 240 / / dynamic figure, multiple of 12 up to 780
    var exconemp;
    var exconem = 100;
    var inf = 0.025;
    Tree var;
    var tec;
    power of the var;
    var fvis;
    var abc;
    var fvee;
    MVT var;
    function myfunction() {}

    Loop 1

    While (ml < = 12) {}
    exconemp = exconem;
    // }
    so that {(ml > 12)
    exconemp = exconem * inf;
    //}

    end loop 1

    trace ("exconemp =", exconemp); employee contribution

    tree = exconemp /(1-0.2)-exconemp;
    TEC = exconemp + tree;
    trace ('tree', tree);
    trace ("tec", tec);
    power = Math.pow (1 + 0.07, 1/12);

    Loop 2

    While (ml < = 120) {}
    ABC = 0.015;
    //}
    then {}
    ABC = 0.01;
    //}

    end loop 2

    fvis = power *(1-abc/12);
    trace ("fvis =", fvis);
    FVEE = tec * fvis;
    trace ("fvee =", fvee); month 1 total
    MVT = (CET + fvee) * fvis;
    trace ("MVT =", MVT); month 2 total
    //

    for (var i: Number = 0; i < ml; i ++)
    {
    MVT = (CET + MVT) * fvis;
    trace ("tfvloop =", MVT);
    }
    }

    I hope that I've explained this well enough.

    Thanks in advance.

    I think that will do it even if I don't quite get the numbers you posted.

    Stop();

    var ml = 48; figure dynamic, multiple of 12 up to 780
    var exconemp;
    var exconem = 100;
    var inf = 0.025;
    Tree var;
    var tec;
    power of the var;
    var fvis;
    var abc = 0.15;
    var fvee;
    MVT var;

    MyFunction();

    function myfunction()
    {
    exconemp = exconem;

    for (var index: uint = 1; index)<= ml;="">
    {
    trace(index + "--------------------------------");
               
    tree = exconemp /(1-0.2)-exconemp;
    TEC = exconemp + tree;
    power = Math.pow (1 + 0.07, 1/12);
    fvis = power *(1-abc/12);
    FVEE = tec * fvis;
                       
    if(index == 1)
    {
    trace ("month 1 total =", fvee);
    }
    another if (index == 2)
    {
    MVT = (CET + fvee) * fvis;
    trace ("month 2 total =", MVT); month 2 total
    }
    on the other
    {
    MVT = (CET + MVT) * fvis; now that we're here the MVT auto perpetuates on himself
    trace ("months" + index + "total =", MVT); month total n
    }
                       
               
    If (index %12 == 0)
    {
    exconemp = exconemp *(1+inf);
    trace ("changed to exconemp to:" + exconemp);
    }
               
    If (index % 120 == 0)
    {
    ABC =. 01;
    trace ("changed abc to:" + abc);
    }
               
    }
    }

  • compariing of data between iterations of the loop

    I am data acquisition of temperature with a Thermocouple NI 9213 drive and DAQ Assistant in a while loop.  I need to compare the temperature of a channel in an iteration of the loop with the temperature of the same string in the previous iteration.  The data collected in each iteration are delivered to a chart and a data storage file.  I know how to get the temperature from the data table in the current iteration, but don't know how to get the temperature of the previous iteration, except perhaps by reading the entire file in a table, determining the size of the table and query the last entries. This seems a bit ridiculous for each iteration of the loop and perhaps even embarrassing.   Any suggestions?

    Put the data in a record time difference. The left terminal of the shift register will have the data of the previous iteration.

    Lynn

  • is this a correct way to write data every time the loop is executed?

    I created a VI, and my goal is to save data every time the loop is executed. So far, I only learned to write binary file... I wish I could write numeric value directly...

    The only problem is that I am not if my method is correct, because I'm afraid that each time that the loop is executed, the previous binary data will be replaced... I don't want that occur.

    Do you think that my logic is appropriate in what concerns the registration data?

    Thank you!

    Your logic is fine. You replace data because the file pointer will be that your data is written. If your program stops, and then you restart, and you want the data to add to the file, you can use the file value position VI and the pointer value 0 bytes of the end. set this position once, after you open the file (so out of the loop) and then data will be added.

    If what you mean by "write a number directly," is to write something in a human newsfeeds format, you can use writing to text file instead of writing to a binary file. Then, use the VI format string or fractional number string VI to convert your double into a string and write it.

  • Value of the loop variable for begins with the last entry of the previous run

    I have a problem with a loop for... I am a beginner with Labview and perhaps do not follow the order of events (since it runs not on a line-by-line as typical of programming languages), but I think that my problem is trivial.

    Say I'm running a loop for 16 iterations and I want to build a table which, for example, consists of four 0s, 1 4s, four 2s and 3 four s.   I initialize the array outside and using shift registers to be added to the matrix in the loop for.

    However, the first time I run the program I get funky results.  In subsequent runs, the first value in my table is a 3, and the rest of the rest of the table is moved down by 1, so I did that three 3s at the end (for example).

    Can someone help me understand how to solve this problem?

    Thank you

    George


  • Variable is empty but the loop is executed

    Hello

    Can someone explain what follows...

    C:\ > $vms = Get - VM

    C:\ > $vms

    C:\ > foreach ($vm in $vms) {Write-Host "Test $vm"}

    Test

    C:\ > Get-PowerCLIVersion

    PowerCLI Version

    -


    VMware vSphere PowerCLI 4.1 build 264274

    Connected to an ESXi 4.1 root hosts, there is no VM then why the loop runs once? I know that to achieve the above, there are easier methods, but for other reasons, I need to loop, it was just a test to prove what is for me a phenomenon.

    Any help appreciated.

    Thank you, Andy.

    Post edited by: avarcher

    I believe that this is because PowerShell by assigning a null value to $vm.  If you want to avoid going there you can test $vm - eq $Null before you begin the ForEach, or you can use $vm = @(Get-VM).

    Dave

    VMware communities user moderator

    Now available - vSphere Quick Start Guide

    You have a system or a PCI with VMDirectPath?  Submit your specifications to Officieux VMDirectPath HCL.

  • Event inside the loop 'for' confusion

    Hi all

    I have an event inside a N = 2 for the loop, which generates an array of 2 elements (auto-index mode). The first value is a first event, the second of the second round. The events are the mouse clicks on a front panel with many buttons control.

    Am I able to access the i counter inside the front loop of 2 elements output table? He does not appear.

    Maybe I want just 2 events in the order I should put two copies of this event in a sequence of 2 image... but it creates the need to set up the event twice... a concern, because it contains many possible sources.

    Ive tried everything in loops, by the way I like a local variable, tunnels, shift... registers but I don't seem to be able to access I have during the loop.

    Can anyone suggest a method or a better structure/approach for this issue.

    In any case, it seems that the program is blocked waiting for the second round, so I can't do anything with the value anyway?

    I want to take action after the first test and before that I'm waiting for the second event.

    Thank you

    Carloman

    OK, you're much too complicated things dong.

    • Use a unique event for all low Boolean mice, then use the ctrlref of output event to detect only one. For Boolean values, you can use an array of Boolean instead of all these individual buttons.
    • Don't do the "table of cluster... unbundle" songs and dances. It's just ridiculous! 'array Index' is sufficient.
    • You need an event for the stop button.
    • The structure of your outdoor sequence has no purpose.
    • The coloring is registered with VI, no need to recolor with each race.
    • Do not reproduce any of this code. Your internal matter differs only in a constant of the diagram, it's everything that belongs inside the case. The "subset of table to replace" belongs to the outside.
    • Now, simply do the processing in a new event and ignore if the State isn't fair. Modify if needed.

Maybe you are looking for