The particular codes within a sequential loop output

I want to leave the individual codes inside the while loop depending on who achieved the result of the comparison first, but do not know how to go on this issue.

Any help or pointer will be appreciated.

TNX

marco73 wrote:

@Altenbach,

I do not understand how you want me to do that, a change of the code will be appreciated.

Here's a stupid enough implementation. Ideally you should design the code as a correct state machine instead.

Basically, once each boolean is true, it will stay true and the code in the case of false is no longer running. Once all are true, the loop stops.

Tags: NI Software

Similar Questions

  • How do the last 4 paintings of a loop output For?

    Hi people,

    I'm almost at the end of my home. I really hope that someone could help me please.
    Any input would be welcome. VI attached.

    Explanation of VI:
    I initialize an array.
    The random number generator simulates my entry camera.
    According to which iteration it is, the data are added in one of the four tables of output.
    "x - y * floor(x/y) ' gives a value of remainder of 0, 1, 2 or 3.
    'Case Selector' just add 1 to "x - y * floor(x/y) ' for case 1, 2, 3, or 4.
    Pictures 1, 5, 9 etc. are added to table 1 (case 1).
    Photos 2, 6, 10 etc. are added to table 2 (case 2).
    3, 7, 11 etc. are added to table 3 (case 3).
    Shots of 4, 8, 12 etc. are added to table 4 (4 cases).
    Average output displays the average value or total divided by the number of photos stored in this table ("Set (IQ + 1)'").

    My problems are:

    (1) I would like to output only the last 4 sets of data from different average output files, 1, 2, 3, and 4 to 4 (i.e. under .csv what is displayed on the screen in indicators "average output was 1, 2, 3 and 4 at the end of all iterations.)
    Where should I put my file save the diagram disabled so that it does?

    Put outside the main loop with automatic indexing on gives me a file with all previous data. (This is not feasible under my number of shots should number in thousands)

    Put outside the main loop with automatic indexing for off gives me only the last data series. (I need the output for 4 tables, not only the last run)

    Inside of the main loop to put (as shown) gives me the same number of files as the number of iterations. (Once again not possible due to the large number of files that will be generated and slow down the camera capture)

    In order to capture fast camera, I wish that these 4 files output only once the entire image capture are over.

    2) would preferably name the file once and for the program to add "(1)', ' (2)', ' (3)' and '(4)' file name tables"output on average"but appropriate file path controls are an another big headache for me.»»»

    3) PS is the initialization of an array enough not to use the memory manager? Or should I initialize 4 Bay?

    I am using Labview 2010.

    Thank you very much
    Charlene

    Hi Laura,

    I assume that you want to store the 4 x 4 table of average production for the last 4 iterations (correct me if I'm wrong). If so, I've set up the example as shown below:

    So, basically, what I did is I created a comparison group to check if the iteration is the iteration total last 4, you have defined. I have included a number to each of the business structures to set in which case it belongs to. The comparator will pass a Boolean result to the structure of the housing that contains the algorithm for writing a file. Since you mentioned that you want to create a file for each of the case, I created as a way to build to create the customized for each case file name. You will notice that there is a concanate string.vi that allows me to customize the name of the file. Since the common file must be exit average, I take the digital constant from the structure of the deal and convert it to a string and concanate to make it in e.g. output average 1. Please note that you need to put a basic path such as in my case, I want to save in the folder named ' New folder (3) "to my office.

    The writing on the case folder occurs only if the condition is true (that is, the last 4 iterations of the loop for)

    Once done, I created the header and write it in this text file and followed by data from spreadsheet on the next line.

    I enclose the code for your reference. I would like to know if this is what you wanted.

    Thank you

    Warm greetings,

    Lennard.C

  • Make the button generate code work in a loop

    I am trying to generate instances of a movieclip in my library on the stage and give them all the single variable and instance names in order to control later and perform certain actions based on the name of the clicked button. I can do it with the following code, but I wanted to use a loop instead to be more effective. Can someone help me to make this code work in a loop? Thank you!

    (labor code)

    var image1_mc:testButton;
    var image2_mc:testButton;
    var image3_mc:testButton;
    var image4_mc:testButton;

    image1_mc = new testButton ();
    image1_mc. Name = "image1_mc"; the name of the instance
    image2_mc = new testButton ();
    image2_mc. Name = "image2_mc";
    image3_mc = new testButton ();
    image3_mc. Name = "image3_mc";
    image4_mc = new testButton ();
    image4_mc. Name = "image4_mc";

    addChild (image1_mc);
    addChild (image2_mc);
    addChild (image3_mc);
    addChild (image4_mc);

    image2_mc.x = 50;
    image3_mc.x = 100;
    image4_mc.x = 150;
    image1_mc.y = 500;
    image2_mc.y = 500;
    image3_mc.y = 500;
    image4_mc.y = 500;


    (Here is my attempt of a loop, but it does not of course because I'm not sure that it is even possible to use a variable to name a variable: D)

    for (var i: Number = 0; i < 4; i ++)
    {
    var (' _mc image "+ (i + 1) +" "): testButton = new testButton();
    addChild ("image"+(i+1) +"_mc");
    'image' +(i+1) + "_mc".name = "image" + (i + 1) + "_mc";
    'image' +(i+1) "_mc".x plus i * 75;
    }

    Hey thanks that pointed me in the right direction. I had not yet used the tables. I managed to do the work. It generates now 4 buttons which return unique names when you press. I also added within the table event listeners. Yet more concise! Here's the code: (interesting bands forum [of the] media if you do not attach code: D)

  • I need to delay the game only once.  My code runs to each loop.

    Hello

    I am new to Flash.  I can't decifer the sample scripts in the help files.  After a lot of trial and error, the following codes works very well.  It delays playback on the video for the right amount of time.  The only problem is when the repeat (as it should) the codes runs again.  I want to only run code during the first thru.  Any help would be appreciated.

    Stop();
    var startTime = getTimer ();

    stage.addEventListener (Event.ENTER_FRAME, delay);

    function timeDelay(event:Event):void {}
    var timePassed = getTimer ();
    If ((timePassed-startTime > = 4000) {})
    Play();
    }
    }

    Thank you


    Doug

    Oh, I get it.  Sorry, forgot some of the intricacies of the animation on the timeline.  Yes, as long as your code is on frame 1 and your return your timeline at the frame 1, then the code will load every time.  What you need to do, is have your code on frame 1, then loop back to the frame 2 to start the next iteration of the film.

  • Change the font within a chain of output colors

    Hello

    I don't know if this can still be done, if I have so no idea what looking to try it. Maybe someone knows or could enlighten us on that.

    I have numerious pages that use the following code to set the page titles:

    < cfset pagetitle = "ACCOUNT SIGN-IN" > ".

    Then, there is a page template that will display these titles in a header on the page accordingly.  It uses the following code:

    < cfoutput > < div style = "padding-top: 20px;" padding-left: 8px; "> #ucase (pagetitle) # < / div > < / cfoutput >

    My problem is this, I have to find a way to make everything in the title of the page after the first word a different color.  So in this example above 'ACCOUNT' would remain the default color and then "SIGN-IN" should be blue.

    Any thoughts?  Thanks in advance!

    > a way to make everything in the title of the page after the first word a different color.

    > So in this example above 'ACCOUNT' would be the default color

    > "SIGN-IN" should be blue.



    #ucase (titleFirstWord) # #ucase (restPageTitle) #

  • For loop within a while loop

    I have for loop within a while loop... admission to the for loop N comes from the VI selection... the while loop I a condition essentially statement it stops just after to finish all the iteration in loop...

    Entrance to the N loop is bascially driven by a local variable... that's the problem Iam having:

    When I press the Start button to run the program... regardless of the output of the select VI is gives the N of the for loop, then the loop starts and then ends in place... and when the output of the select statement takes a different value (the N of the loop for) loop not work until I restart the program again... What can I do so that the for loop runs again for another value of N, the RUN program button is enabled.

    1. clean your diagram.  Style guides suggest keep the pattern of a single screen.  With a little effort, I was able to get your DB less than 1600 x 1000 pixels.

    2 then I can see (some) it happens all at once. This thing does nothing?

    3. local variables can lead to race conditions.  Output in Angle position may be a race condition, although is probably not what you wanted to do.  What does the wired local time at the moment present terminal meter? (Ooops! Two controls with the same name - which can be quite confusing as well!)  If you need or want two components of façade having the same text, use the legends.  Make the labels is different so the comic is more readable.

    4. having more than one Dequeue function on the same queue will lead to unpredictable results.  When an item is removed, it is removed from the queue and is not accessible to any other Dequeue function.  In parallel loops, you have no way of guessing which Dequeue will seize any particular element.

    5 use Boolean reverse instead of Select with wired False to true and true cable at the entrance to false entry. Better, just make the case of forgery in the structure of the case within the for loop the real deal. No required reversal.

    6. I was not looking for to determine the logic of the code within the structure of this case. It seems I could have posted a much simpler way to do this several weeks ago.

    7. use multiply from the Digital Palette rather than a node form multiply by 4 or 1.8. Uses less space BD and is much easier to read.

    8. as has been suggested, learn how to work the machine architecture and the State of producer/consumer.  They can make your life much easier.  Do not try to convert immediately to these models.   It's too much bite to at some point.  Learn how they work first.  Make a few simple examples.  Then rewrite this program in this format.  Probably faster than fixing what you have now.

    Lynn

  • pass-through of a Subvi to the next level with continuously running loops

    Hi all

    It is a very simple question, for some reason, data available as a Subvi indicator doesn't it up level vi. I think it might be something to do with the while loop I use, but I cannot understand, any help will be appreciated. I don't think I quite understand how data comes out of a loop constantly running.

    GPSdisplay runs a driver called GPS.vi (im not worried for my event structure immediately, which could be bad, but I am yet to test this bit yet) 1 probe should have the values of GPSCluster

    Loop in GPS.vi. GPSCluster (sensor 2) is updated correctly

    I can't work on why the data is not passed to GPSCluster at the top of page vi

    Hi bennymacca,

    I think that you are on the right track with a FGV. You can do quite easily with GPS vi you have.

    Before going further, your GPS while loop will return only the last reading and because the Boolean value of "Read" output state is set to FALSE, it will not stop. You see it out at all? The logic, I read, once entering this while loop, that he will not stop until said.

    There are 3 options you can try.

    (1) use a FGV, because you are looking in. To do this, you need to change the boolean TRUE State and set records in the GPSCluster - to analyze the information around, holding each time the vi is called and you leave. Outside the while loop you will thread to the top of the cluster to the indicator that you want to collect (OR you can have it inside the case statement where you read - be careful here, if).

    (2) in the main code, above the frame of the sequence, you can place the GPS vi while loop (the ' read' a), given the State of the boolean connected to a local variable of the Stop button. This while loop will start depending on how feels LV, wire, one line error for the two while loop and Frame (indicating that the two are to run in a parallel mode), OR you can put it in a case statement and say 'go' when you want to start playback. In this while loop, you can then copy the data to read directly in your variable Cluster that it is generated.

    But with (2), you move yourself away from the purpose of the GPS vi, which would be to bring all the features of the GPS functionality in a vi - which is a good idea.

    (3) put a condition on the State of the Boolean case "Read" statement - just make it TRUE when you want to stop reading the data (do you have a time or a condition, you can check here?). Even by doing this, you would / may still need to shift on your lease registers loop to keep the data for each iteration.

    I hope that all of this help. See you soon. David.

  • Get the array of unknown size of the CVI code module

    I'm creating a type custom for my client, and I've encountered a problem that I'm not sure how to solve.

    Here's the situation:

    We have a custom step in which the main code is executed within a step after step. The code acquires samples of an instrument, but it is unclear how many samples will be returned. The CVI function has a table, the size of this table and an output parameter that indicates how many samples have been returned as parameters.

    void AcquireSamples (double* samples, int samplesBufferSize, int *numSamplesRetrieved)
    

    The goal is to have the array returned by the size of the number of samples taken.

    I tried several ways, none of which works completely. The problem is that, as described here, TestStand creates a temporary table to move to the code module. but it does not resize the TestStand array property. So I need to manually resize the properties of the table, and I did not understand an elegant way to do it.

    It would be easy if I had to create just a not, because I could use expressions after. I'm creating a type but I don't have that luxury (my code should allow the customer to enter expressions of post, but I run the risk of my client, removing any expression after default I get home).

    First question:

    I noticed when I was creating a stage with a CVI code module, that additional results allowed me to specify logging in both settings [in] and [out]. This I extrapolated that the parameter expression was evaluated before calling the function both again after the call to the function. I did some tests, and it doesn't seem to work that way.

    (1) this is expected behavior? I don't see it documented anywhere, if can I rely on it remains the same in future versions of TestStand?

    I used this behavior to my advantage to create an expression that does what I need an an step code module. But it does not work for a module of code to a later stage.

    I did a small test DLL file and sequence illustrates my problem. I tried to document the file in sequence to show where I'm stuck. You will need to put the DLL in one of your directories to search for the type of custom work.

    Any help would be greatly appreciated!

    I think the problem is that the C programming language does not provide enough information for a caller to know the size of an output table in any kind of standard. I recommend again, you pass a CAObjHandle which is the variable of array instead and set the table directly using CA_Array1DToSafeArray() to create a safearray and SetValVariant on the propertyobject which is the property of the table to set the table. Don't forget to free the array (using CA_SafeArrayDestroy()) that you created with CA_Array1DToSafeArray after that SetValVariant call to avoid leaks.

    Hope this helps,

    -Doug

  • Exception in the external code called by calling the library function node problem

    Hello, I am a complete newbie in LabVIEW and need help. I have run tests of reliability and get this error about 2000 cycles. The code sends the digital output of a cylinder which operates the actuator downwards, he reads a signal of the thing I'm testing. Then there is a signal to then drive the actuator to the top and repeat. After about 2000 cycles, I get the error:

    [LABVIEW: an exception occurred in the external code that is called by a node call library feature.] It might have corrupted the memory of LabViews. Save all work to a new location and restart LabView. VI "Footswitch.vi" was arrested at the node 0 x 0 of the Subvi "DAQmx Start Task.vi 7"]. "

    I created this code without any prior knowledge of LabView, so I know it's not good, but it does not have (somehow). Any help would be greatly appreciated. Thanks in advance. I am also attaching the VI.

    cstemm,

    There are a few obvious errors in the code that must be addressed.  First of all, I'm not sure how your code even survived 2000 cycles, you have a Boolean value enter these while loops:

    What happens if you read a false? The curls will be stuck in an infinite loop... as the value read from the tunnel will never change, and the stop condition will always be "false".   I think that what you do... was keep reading the numerical value until it is true, so it's what needs to be in a while loop.

    Now, the problem you are experiencing is most likely a result of mass overload of start/stop tasks.  For these digital readings, simply start the task once and stop the task once. Run the start task until your main loop work... reference col in the task and read when you want to. Then, when the main loop is completed, go to this thread of task outside the while loop to clear tasks and stop.

    Programming paradigm is generally (there are exceptions):

    Initialize (startup tasks, the initial set of controls, etc.) -> the main loop (here, most of the code is readings/writings/calculations)-> References(stop tasks, clear data, close any open file references) close

    You don't do any reads buffered of digital lines, so no need to ever stop or restart the task, it gives you just a value whenever you call playback vi.

  • SWIFT playgrounds, how to Code 2, build a loop, I can not find isOnGem

    Swift playgrounds, how to Code 2, build a loop, I can not all isOnGem. What Miss me? If I am not mistaken, is it a bug? How should I declare?

    I can't figure out how to solve the puzzle without this.

    isOnGem is not available as an option in the box to scroll so just type in from the table instead. If you enter exactly the same case, it will be recognized as legal code when you run your program.

  • What is the color code HTML/CSS orange for the app button using Firefox?

    I'm trying to customize the color of the button app for all night in the dark blue with orange of Firefox used in stable output via the file userChrome. The closest I have is #FF6600, but it doesn't seem to be an exact match. I searched online for an answer, but I couldn't find anything that told me what is the color code. Can someone help me please?

    Well well, after some research more, I found an add-on that does what I was trying to do it manually. Thanks for the help though. https://addons.Mozilla.org/en-us/Firefox/addon/customappbutton/

  • The survey code will be corrected?

    The beep code < embed SRC = "birds.wav" loop = "true" HIDDEN = true > does not work in Firefox 4.0, but worked in earlier versions (this is not a question of individual computer). " Read the other posts, I see that Firefox now wants an extra piece of code specifying what plugin to use.

    The old Firefox doesn't have to require as well and not only Internet Explorer. My question is, Firefox will remove the requirement for this extra step in the future?

    The reason I ask, is that I probably created 30 CDs a few months ago with a family website (not online). His was a big part of it. If this will continue, I will be having to do the Update CD or I'll have to direct all Internet Explorer instead. Thank you.

    Note: I have attached the url to a different site, I throw the same problem just so you could see an example of the code does not not on firefox 4.0.

    Please click the button quite useful next to the answer that solved your problem of Firefox support, When you are connected, so this thread is marked as resolved to help other users who may have this same problem.

  • How to publish the source code

    How best to publish the source code?

    I need an alternative to fall back on.  How I would go to this topic if I had to use HTML.

    My chance to validation code has deteriorated over time. I did it via:

    I take the plain.

    Yesterday, when I tried to insert the Bash source code.  I had a lot of white lines.  I think that leading # confused CSA.

    
    #!/bin/bash 
    
       # so anyway, output from the echo statement is sent to the terminal.  The operands < and >
       # allows you to change where it is going.
      
    
    # default redirection  
    
    # 0 stdin  -- standard input
    
    # 1 stdout -- standard output, non-error output
    
    # 2 stderr  -- standard output for error messages.
    
    # had not used the exec statement before, the concept of the exec was
    
    # readily apparent to me.
    
       
    
    # of course, I ripped this off.  Turns out you want to preserve where input stream 0 is
    
    # coming from. The hack moves input stream 0 to input stream 6.  Pick any number
    
    # that is allowed.
    
       
    
    # save standard input in file descriptor 6 
    
    exec 6<&0 
    
       
    
    # now we say where we want input stream 0 to come from. 
    
    # bash has an unknown to me number of commands that read from input stream 0
    
    # via redirection we can change were stream 0 is coming from.
    
    # redirect standard input to be from the passed file 
    
    exec 0<${1} 
    
    count=0 
    
    while read lineIn  
    
    do { 
    
    # bash syntax is bizarre.   
    
    # The (( )) says it's a math expression 
    
    (( count++ )) 
    
    echo "${count}: ${lineIn}" 
    
    } 
    
    done 
    
    # put the input streams back to where they were before. 
    
    # Nice, but when the script quits they will all be put back to where they were.
    
    # Of course, I copied this stuff.  Syntax isn't the obvious.
    
    # close input.  May not need.  My innovation.  Seems nice.
    
    exec 0<&- 
    
    # restore file descriptor 0 should be standard in 
    
    exec 0<&6 
    
    # close file descriptor 6 for reuse. 
    
    exec 6<&- 
    
    echo 
    
    echo "Total lines were ${count}" 
    

    Do you get the extra lines before applying syntax highlighting? You can simply change the Courier New font.

    #! / bin/bash

    # Anyway, Exit statement echo is sent to the Terminal.  The operands< and="">

    # allows you to change its future.

    default redirection #.

    # 0, stdin - standard input

    # 1, stdout - output standard output without error

    # 2, stderr - standard output for error messages.

    # did not use the exec statement before, the concept of the exec has been

    # obvious to me.

    # good course, I snatched it.  Turns out you want to keep where the input stream 0 is

    # coming. The cut moving the input stream to the stream input 6 0.  Choose any number

    # who is allowed.

    # Save the standard entry in the file descriptor 6

    exec 6<>

    # now say us where we want to enter flow 0 to come from.

    bash # a a stranger to me the number of commands that read from the input stream 0

    # via redirection, we can change were stream 0 comes.

    # redirect the standard input from the file passed

    exec 0<>

    Count = 0

    while reading lineIn

    {}

    bash # is weird syntax.

    # (()) Is a mathematical expression

    ((count ++))

    echo "${number}: ${lineIn}.

    }

    fact

    # put the input stream to where they were before.

    # Nice, but when the script closes they will all put back to where they were.

    # Of course, I copied this kind of things.  The syntax is not obvious.

    # entry closes.  May not need.  My innovation.  Seems nice.

    exec 0<>

    Restore file descriptor # 0 should be standard in

    exec 0<>

    # close the file descriptor 6 for reuse.

    exec 6<>

    ECHO

    ECHO "the Total of the lines were ${number}.

    TT2

  • The create a System Image will save the FPGA code and the RT code?

    I have some cRIO systems which were broadcast in our manufacturing plant for some time. A slight problem has been discovered in the programming and created a workaround solution, but a fix should be implemented. Currently, I have no way to test my new code without loading on the cRIO and it works on the tool while the product is running. If there is a problem and I need to do some debugging, the tool cannot be down for an extended period. I would write a vi that will save an image of the cRIO so I can reload the software that is currently running and prevent a situation of prolonged downtime.

    My question is, when I did in the past with a product that has different tests, calibration and the final client software RT, it seems that the code FPGA not be saved (not a big deal at the time since the new FPGA code was compatible with different deployments RT). The new FPGA code won't be compatible with the old RT software, so now I'm worried. I would like to just check on it until I have all the boss breathing down my neck. If the service will not save the bitfile FPGA, is there anything else I can do for the tool to return to the previous running state while I solved problems that may exist with the new code review? The original code was lost by my predecessor. Otherwise, I would use just that.

    Hi Jeremy,.

    You are right, because the create a System Image does not record the bitfile with the image of the RT. Using the configuration system API, you will need to deploy the RT image and then the bitfile FPGA compiled later. To ensure that you can return to the previous version of the software running on your RIOs, you could simply save the current image and bitfile before deploying the new image and bitfile.

    However, the best way to proceed is to use replication Deployment Utility (RAD of OR). I have provided the link to the tutorial on the wheel, where you can download the utility. This exe will make images of the any of your RT targets and will also include the bitfiles with them. You can also deploy these images to several targets at once. In particular, you can read about the Bitfile (s) configure for FPGA Deployment Flash; the bitfile will be deployed at the start when stored in flash memory.

    Replication and deployment (RAD) utility-

    http://www.NI.com/example/30986/en/

  • for loop nested within a while loop

    I wrote a data logging VI to get data from a data acquisition, then write on a worksheet. It worked well. What I'm trying to do now and I am having problems is to place that vi within a while loop that will automatically write a new file name after the loop For ends its iterations. In a text based program when the loop finished I would just send it to the while loop for her write the new file name, and then run the loop data collection and spreadsheet iterations of writing.  Here is the general outline of the operations of the program.

    Set the file name and path based on iterations of the loop (eventually this will be the date and time)

    run to the loop for the specified iterations:

    read DAQ

    write data to a .csv spreadsheet

    In specified iterations are more:

    new name of file writley

    Rerun the loop for

    Repeat this until you press stop

    What actually happens is the file name and path are established, the loop runs through its iterations, but wrote that the last set of data and then the program stops.

    any ideas?  Program attached

    Don't know about the termination of the program. I replaced the methods with a random number generator and everything seemed good environment according to the writing of worksheet to add instead of create a new file each time that work.

    p.s., cleaned up the wiring to make it readable - counties of cleanliness.

Maybe you are looking for

  • Firefox behaves differently on computers

    I use Firefox on all my devices. (Thanks!) I just got a book of Surface. Tried to connect to sites I normally connect with my laptop and phone, tablets: google, gmail, etc.. Get an error message saying there is a problem with the site certification (

  • How to make a game

    Like a real game you can copyright and you add your website

  • I am trying to create a VPN connection, but it does not work

    I am trying to create a VPN connection, but it does not workThe wizard cannot establish a connection. And if I try to record simply does not connectIt does not work. If I try to click on find the problem, there simplydo nothing.I tried it on another

  • Relocation of PSE 14

    In order to address a problem with Photoshop elements 14, I installed my copy of PES 11 as an alternative.But he took over all file associations (.dng, .jpg, etc.) which formerly pointed to PSE 14 and 10 Windows is not easy to change in the settings.

  • Clear events and task log

    Buongiorno ROMA pulire I connect oggetto, ho trovato una KB che mi used che questi log li trovo dentro "HOSTD.log", but also pulendo questo log Event remains a video.