Why does while loop pause during operation

Hi everyone,
I have written the attached code which will eventually be a part of a bigger program. The program is intended to log some test value, in this case just the date and time  to a csv file  when a button is pressed (log in WHITE, loop1).  Loop2 is intended to read a test value from a line in the first csv file and then add an extra test value to the end of that line when the serial number matches and then saves that line to a new csv file. This all works well but loop2 seems to pause a few times before continuing when either of the log button is pressed. I tried putting the code in 1 while loop with no success. Can anybody see what I am doing wrong?
Attachments:
ResinV10_csv.vi ‏25 KB

Maiz wrote:
Can anybody see what I am doing wrong?
In addition to waht has been said already, your code is extremely convoluted.
How often does the "read" file change? Do you really need to read the entire file with thousands of rows every ms just to look at one row?. If the file never changes, you could read it once before the loop.
The way do do array opearions is mind boggling. You take one row, Index out the first element twice in parallel (once is enough!), then you index out the first element, built it into an array of one element, and compare that array with a scalar. Would't comparing the orignal element with the scalar be equivalent?
Index array is resizable, you only need one instance.
Getting five elements in a row just to build them back into a 1D array seems rather pointless. If the array has only five elements, there is nothing to do, and if it has more elements, you cold use "array subset", and if it has fewer elements, use "reshape array" to size 5.
The correct format for reading strings is %s (not %.10f).
Since you want both loops to run at the same speed, why don't you put it all in one loop? (this even eliminates the local variable) Then you could use a parallel loop for the file saving, using queues in order not to slow down the main loop. In the parallel loop, open the files before the loop, use lowlevel writes inside the loop, and close the files once the program stops.
Can you explain your setup and what the program is supposed to do? I am sure it could be done with 20% of the current code.
LabVIEW Champion . Do more with less code and in less time .

Similar Messages

  • Why does Prelude keep pausing during playback on ingest from a P2 Card?

    When I am trying to mark my ins and outs on ingest.  The video will not continue playing.  It pauses a second or two after playing.  How can this be fixed?

    Among the alternatives not mentioned... Using a TiVo DVR, rather than the X1; a Roamio Plus or Pro would solve both the concern over the quality of the DVR, as well as providing the MoCA bridge capability the poster so desperately wanted the X1 DVR to provide. (Although the TiVo's support only MoCA 1.1.) Just get a third-party MoCA adapter for the distant location. Why the hang-up on having a device provided by Comcast? This seems especially ironic given the opinions expressed regarding payments over time to Comcast. If a MoCA 2.0 bridge was the requirement, they don't exist outside providers. So couldn't the poster have simply requested a replacement XB3 from the local office and configured it down to only providing MoCA bridging -- and perhaps as a wireless access point? Comcast would bill him the monthly rate for the extra device, but such is the state of MoCA 2.0. Much of the OP sounds like frustration over devices providing capabilities the poster *thinks* they should have.

  • In the attached VI why does one loop coerce the data type while the other doesn't?

    In the attached VI why does one loop coerce  the data type while the other doesn't?
    Solved!
    Go to Solution.
    Attachments:
    AAA.vi ‏8 KB

    I'm guessing you created the Enum on the front panel.  If you right-click it and create an indicator, it will match the type, and be an enum.  LabVIEW represents enums as U16, but because the types aren't identical (for example, your enum has 3 values, but a U16 has 65,536 values), LabVIEW automatically coerces (or converts) the smaller (enum) representation into the larger (U16) value.

  • Why does Labview VI pause intermittently during motor control while loop?

    I'm performing some biomechanical testing using Labview to control stepper motor actuators. I have a PCI-7334 controller card and a MID-7604 driver. The testing is run in load control using a while loop that sends a number of steps to the stepper motor that is proportional to the difference between the actual and desired load. The VI intermittently pauses though and sits in active for several seconds (~5 sec to 20 sec). What could cause this problem?
    Thank you in advance for your assistance.

    Without the subVIs it is hard to see what is going on.
    Some general comments:
    1. Block diagrams should be limited to the size of one screen.  Yours is over 4 times as wide as my 27" screen.
    2. Sequence structures should be avoided.  LabVIEW is a datflow language and only rarely are sequence structures required. There is almost certainly a way to write your program without them.
    3. The use of local variables should be avoided.  Again, they have a place but most likely they are not needed in your program. They are prone to race conditions, make extra data copies, and force execution in the UI thread.
    4. Floating point data types are not recommended as case selectors. They will be rounded and coerced to integers.
    5. Learn about the Producer/Consumer Design Pattern and state machines.  
    One possible cause of your slowdown is having the Write to Spreadsheet File.vi inside the while loop. This VI is convenient to use but it opens, writes, and closes the file each time it is called.  I have no way to tell how much data you write on each iteration but as the file grows the OS may need to re-allocate space for the file or fragment the file. These operations can be slow.
    Do you really want to Abort the program in the False case?  This will leave any outputs in the last state they had been set. This could have your motor(s) running, clutch engaged, ...  In programs which control physical hardware an orderly shutdown procedure is usually better: set all outputs to a safe condition, close files, close DAQ tasks, and indicate the status to the user.  Calling Stop allows none of this to happen.
    Lynn

  • Why my program does not loop back during invalid input?

              boolean invalidNum = false;           
                      //Questionnaire Number
                        do {
                        System.out.print("Enter Questionnaire Number [ ] ");
                          try
                               inputQuestionnAireNum = Integer.parseInt(input.nextLine());
                               if(inputQuestionnAireNum <0 || inputQuestionnAireNum>100){
                                    System.out.print("Invalid: please enter between 1 to 100 \n");
                               } else {
                                    invalidNum = true;
                          catch (NumberFormatException e)
                            System.out.print("Invalid try again \n");
                        } while (!invalidNum);
                        //Age input
                        do {
                             System.out.print("Enter Age [ ] ");
                               try
                                    inputQuestionnAireNum = Integer.parseInt(input.nextLine());
                                    if(inputAge <0 || inputAge>100){
                                         System.out.print("Invalid: please enter between 1 to 100 \n");
                                    } else {
                                         invalidNum = true;
                               catch (NumberFormatException e)
                                 System.out.print("Invalid try again \n");
                             } while (!invalidNum);
                        //Postal code
                        System.out.print("Enter Postal Code [ ] ");     
                        inputPostCode = Integer.parseInt(input.nextLine());Result:
    1 new entry or 0 print1
    Enter Questionnaire Number [ ] w
    Invalid try again
    Enter Questionnaire Number [ ] 33
    Enter Age [ ] w
    Invalid try again
    Enter Postal Code [ ]
    why age input does not loop back and prompt for re-enter during invalid input ? instead it proceed to print the next line.

    Apparently because you don't reset "invalidNum" after the first loop.
    Your code would be a lot easier to read if you didn't use the word "invalid" to mean "valid".

  • Why does my system freeze during reader install on windows 7

    why does my windows 7 system freeze during adobe reader installition

    Is is hard to say. It could be anything from a corrupt font, interference from virus protection, corruption due to a virus, hard disk directory problems, etc. Are you able to download the full installer? Did you have a previous version of Reader on your System? What version of Reader are you trying to install?
    Generally, if you clean your system of previous versions and bad installs:
    http://labs.adobe.com/downloads/acrobatcleaner.html
    You can then install. Try using this installer:
    http://get.adobe.com/reader/enterprise

  • Why does rs.next() pause for sometime while retrieving records

    I'm trying to read records from the result set.
    At some point the rs.next() gets stuck.
    It takes lot of time to execute the rs.next() but the records are finally retrieved.
    Could some one tell me why this happens.
    I'm using a PreparedStatement to execute the query.
    Thanks
    Kalyan

    Maybe because the database returns records in batches rather than one at a time to the JDBC driver, so that after you process the first 200 records, there's a pause while it fetches the next 200? You can sometimes affect this behaviour by using the setFetchSize() method.
    Or maybe because there is a spike of network traffic that slows down your retrieval?

  • Why does Labview Server shutdown during TestStand execution

    Greetings All,
         Please forgive me if this question should've been posted on the TestStand side.
         What would cause the Labview Adapter Server to shutdown?  I've noticed that each time I click the Test UUT's (green execution arrow) button that during the analysis part before the client actually brings up the serial numbers screen, the Labview Adapter Server initializes.  The task bar would always show TestStand 2010 and Labview 2010 (Getting Started screen).  We are running a batch sequence that is monitoring four (4) uut's during an ESS profile and performing various testing at three (3) different temperature levels.  The process is kind of lengthy (2-1/2 days).  From what I could see the test was in a loop, as usual, waiting for a response from the thermal chambers internal relays which tell the TestStand program that the chamber has begun to move to the next temperature.  I notice that there was an ERROR displayed on the side of one of the batch sequences which was reading one of the PXI-6509 inputs.  I took a screen capture at that point before doing anything further.  I didn't notice it at first but looking at the screen capture again I noticed that Labview was missing from the task bar.
         I am wondering what could have caused this and if there is anything to prevent this from bitting me again.  This client sequence was running well for two (2) days and this happened with less than 12 hours of testing to go.  Thank you for any information that you provide with regards to this question.
    Regards,
    Scott

    Hi snowpunter,
         Sorry I didn't get back to you sooner.
         Unfortunately there are too many users that think too much and close things before my team has a chance to look at the failure when it happens.  There is a remote possibility that someone closed the Labview application by accident.  There are many times that the Labview screen pops up in front of the TestStand screen while the sequence running and someone closed out Labview because they couldn't see the execution.
         It doesn't appear that there are multiple threads trying to access the PXI-6509.  The contractor that did most of the programming utilized a lot of Batch Synchronizations to prevent this kind of thing from happening, not that it isn't possible.
         I'm wondering if there is a way to disable the operator from shutting down Labview, whether by the RED "X" in the top right corner or Menu-File_Close.  If so, How would I accomplish this?  Thanks in advance for any reply you have to offer.
    Thanks,
    Scott

  • Why does youtube keep pausing?

    Can anybody tell me why youtube keeps pauseing
    when I try to watch something. How do I fix it

    It is probably buffering. Wait a little while after it loads before you play it.

  • Why does my ipod pause in between youtube?

    When im watching something on youtube, it pauses withour me even touching pause.Why???

    It could be the the download speed it to slow for continious and the the video stops while tyhe buffer is filled up to allow more playback.

  • Why does CS6 forget commands during batch actions after awhile?

    I have done this over and over and been absolutely positive that the darken command as well as the transparency command were given to a layer for batch processing - it does fine during a short test but when told to do a large batch after a short time both commands are mysteriously GONE. Any ideas why? - this is driving me nuts and I ain't got far to go so I need help

    Gone from where? Darken from blending modes ? Where was the transparency command that is now gone?

  • Why does this loop create a 3D array instead of a 2D?

    Hi,
    This should be a relatively simple question. I am feeding a 1-D array (1 x 801) in a loop into a build array function and looping it back on itself to build the array. I am rather confused as to why this is producing a 3D array, can someone explain why?
    Thank you,
    Michael
    Attachments:
    QCM.vi ‏113 KB

    Where are you seeing the 3D array? If it is at the far right of the diagram, at the edge of the FOR loop, it is because you have the autoindexing set, which is going to make a 1D array of your 2D array data, a 3D array. As the two sub-vi's didn't come with your vi I don't know what the one with the "17" as an input does, nor what the other one does either, other than apparently produce two 1D arrays.
    Putnam
    Certified LabVIEW Developer
    Senior Test Engineer
    Currently using LV 6.1-LabVIEW 2012, RT8.5
    LabVIEW Champion

  • Why does Encore CS6 quit during startup and how can I get it to stop?

    I am using Encore CS6 on Mac OSX 10.9.1. After spending all afternoon purchasing, researching and downloading the newest Encore (because CS5 would no longer burn anything on the new operating system), every time I open Encore, it unexpectedly quits. There is no error message, it loads Encore to the point where you can see all the Encore windows, and before asking whether you are opening an existing project or starting a new project, the program quits. Any help would be greatly appreciated, thanks!

    Encore is not supported on that OS, and may not work http://www.adobe.com/products/encore/faq.html
    Adobe/Jive have a BAD title for the SEARCH THIS FORUM function
    Go to http://forums.adobe.com/community/encore and, in the area just under Ask a Question, type in
    maverick
    or
    mavericks
    You may now read previous discussions on this subject... be sure to click the See More Results at the bottom of the initial, short list if the initial list does not answer your question
    Do the same at http://forums.adobe.com/community/premiere

  • Why does my Mac Book Pro operating OS X version 10.7.4 startup so slowly?

    My Mac Book is less than one year old and it is already bogging down considerably and operating slowly.  The problem began after I inadvertently filled the hard drive to capacity.  After noticing that the hard drive was full, I cleaned out half of the space.  I cleaned out the downloads, trash, archived large files, and moved misc. information to an external storage device.  However, since filling the hard drive my computer takes much longer to reach the login page--usually a minute or more.  After logging in the computer takes another minute or longer to fully start up.  I have also noticed that the overall performance is more sluggish now.  Any suggestions?  I look forward to your help and comments.  Thanks!

    Launch the Console application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ If you’re running Mac OS X 10.7 or later, open LaunchPad. Click Utilities, then Console in the page that opens.
    Step 1
    Select "system.log" from the file list. Enter "BOOT_TIME" (without the quotes) in the search box. Note the timestamps of those log messages, which refer to the times when the system was booted. Now clear the search box and scroll back in the log to the last boot time when you had the problem. Post the messages logged during the time something abnormal was happening. That time might be before or after the boot.
    For example, if the problem is a slow startup taking three minutes, post the messages timestamped within three minutes after the boot time, not before. If the problem is a system crash or freeze, post the messages from before the boot time, when the system was about to crash or was failing to shut down. In either case, please include the BOOT_TIME message at the beginning or the end of the log extract.
    Post the log text, please, not a screenshot. If there are runs of repeated messages, post only one example of each. Don’t post many repetitions of the same message.
    If the log doesn't go back far enough in time, scroll down in the Console file list to /private/var/log/system.log.0.bz2. Search that archived log, and if necessary the older ones below it, for the same information.
    Important: Some private information, such as your name, may appear in the log. Edit it out by search-and-replace in a text editor before posting.
    Step 2
    Do the same with kernel.log.
    Step 3
    Still in Console, look under System Diagnostic Reports for crash or panic logs, and post the most recent one, if any. In the interest of privacy, I suggest you edit out the “Anonymous UUID,” a long string of letters, numbers, and dashes in the header of the report, if present (it may not be.) Please don’t post shutdownStall or hang logs — they're very long and not helpful.

  • Why does my nike  pause at every quarter mile

    every .25 mile when it tells me how far and time then it pauses and I have to hit restart then do it again at .50 and so on    why???

    Just because you have a large library doesn't mean you can't set up your itunes library as a primary (syncing) library.
    This of course doesn't address your problem but is likely to provide you with way to compare viewing synced material and streamed material on your tv, it might also turn out to improve your viewing experience as there are a number of advantages to having a primary library over a secondary one.

Maybe you are looking for

  • How many invoices printed

    hi I like to know how many times a purchase order report or invoice report is printed and how do i stop the user from reprinting the same report Any functional advice will be really helpful. Regards Sudharshan

  • Mac pro as router, should i use INTERNAL airport or EXPRESS for wireless

    hello i want to set up my macpro as a simple server, sharing internet wirelessly and providing storage for TM backups and media files. i also want to access it remotely via Back To My Mac when on the road. i have an airport express that i bought for

  • MOST OPTIMUM RT SETTINGS for sequence/timeline when cutting HD

    i cutting 720/24p HD on a MBP and am wondering what are the optimum settings? here's what i'm using as of now: http://f.imagehost.org/0132/FCPtimelinesettings.png i'm getting random dropped frames, have to render clips often, etc etc... just want to

  • Texting field does not automatically open upon tapping in iOS6?

    Hey there, I've noticed since I upgraded to iOS6 that the field at the bottom of my text message screen, which allows you to input the text message reply, doesn't open when you tap it. Instead, to open it up, I have to swipe from the bottom up. Is th

  • Creating executable files

    Hi, i have a working java program and i would like to create an exe program (or installer if you would like to say) so that when I double click on it, it will install all the necessary files. afterwards, I will also want to create a file that when do