Writing a file for prescribed amount of time in a while loop after the triggering condition is met

Hello Guys,
I am trying to program an application in which if the trigger condition is met it should start to write the file.
I was able to do that, but if I want it to be written for certain amount of time, and once the trigger condition is met, it should continue to write the files for prescribed amount of time. I was not able to do this. The file name should also be updated accordingly.
I tried to with some options by keeping the creation of the file outside of the loop, if I do that then if the trigger condition is not met it will stop writing and I dont want that, as once the trigger condition is met it should be true thereafter.
So I cant keep any thing outside the while loop, bcaz then it checks the condition of the shift register for the trigger and I have it as a false constant.
I am attaching my application which is kind of mess and I have written in the application where I am having problems. For every iteration of while loop it makes a new file, and i dont want that, I want to write specific amount of time data to the each file.
Please take a look at my code and help me in solving the problem. Any insights and examples on how to do this thing will be a relief to me.
Thanks in advance.
Regards,
Nitin
Attachments:
PXI_4462_Sync_and_Stream_trigger.zip ‏192 KB

what i am saying is to keep track of how much data you have written and whenever you need to make a new file you make 1.
here is a vi that i just made that should show you. let me know if you need any help understanding it.
Attachments:
new file exemple.vi.zip ‏21 KB

Similar Messages

  • Writing binary file for fixed amount of time

    Hello, I'm trying to write a binary file of multiple channels for a fixed amount of time before I perform my analysis. Does anyone know the best way to accomplish this?

    Here is an example of one way to do what I think you are trying to do. There may be a more elegant way of doing it, but this is pretty simple and straight-forward. It basically writes a 5-integer array for 5 seconds and then stops. Let me know if you have any questions.
    Attachments:
    timed write.vi ‏27 KB

  • My phone is getting freezed for some amount of time when i try t unlock the phone

    hey guys do yu have the same problem ?              

    i mean slide to unlock
    and often wen i try to save a dailed no into new contact < after typing the letters also they are not getting displayed

  • Is there a way to create a custom screensaver with pics/slides that display for different amounts of time?

    Is there a way to create a custom screensaver with pics/slides that display for different amounts of time? Or even add a "video slide" into the screensaver?
    My business has 3 TVs displayed in our lobby, each with its own apple TV and they are all linked to the same photo stream. Currently the Atv screensaver displays the photostream pictures of our products for the default 3 seconds. We just added pics/slides that now display messages and useful info for our customers but I want that info to be displayed for a longer period of time than the pictures to give people a chance to read it.
    I tried using flickr and powerpoint as a work around but no luck.  I created a slide in powerpoint with play length of 15 secs and saved it as a wmv file.  I added that file to a "screensaver" set in flickr and pointed the Atv screensaver to that flickr set.  It still displays everything, pics and the wmv file at the default 3 sec.
    I know I can increase the duration of all pics in the screensaver to display for longer but the goal is to have the pics display at 3 secs and the info slides to display at 15 secs.

    Welcome to the Apple Community.
    No that's not possible.
    If you have any suggestions that you think might enhance the Apple TV you can send Apple your feedback here 

  • Playing jpeg pictures for different amount of time

    hello everyone.
    i'm new to jmf and i have been reading a bit about it. so i tried the sample code at: http://java.sun.com/javase/technologies/desktop/media/jmf/2.1.1/solutions/JpegImagesToMovie.java (THIS WAS VERY HELPFUL)
    this program displays each image for 1 second each.
    now my problem is, i want to display these pictures for different amount of time... for example: display pic1 for 1 second, then display pic2 for 3 sec and so on.
    can anyone help me please. THANKS

    >
    i'm new to jmf ..>The [JMF forum|http://forums.sun.com/forum.jspa?forumID=28] is the best place to ask JMF related questions, but I am guessing you are also new to Java, and to programming, so this forum might be best for the moment.
    >
    ..and i have been reading a bit about it. so i tried the sample code at: http://java.sun.com/javase/technologies/desktop/media/jmf/2.1.1/solutions/JpegImagesToMovie.java (THIS WAS VERY HELPFUL)
    this program displays each image for 1 second each.
    now my problem is, i want to display these pictures for different amount of time... for example: display pic1 for 1 second, then display pic2 for 3 sec and so on.>Well.. given a run of [JpegImagesToMovie.java|http://java.sun.com/javase/technologies/desktop/media/jmf/2.1.1/solutions/JpegImagesToMovie.java ] might go..
    java JpegImagesToMovie -w 400 -h  300 -f 1
      -o the.mov pic1.jpg pic2.jpg pic3.jpg..you might instead try..
    java JpegImagesToMovie -w 400 -h  300 -f 1
      -o the.mov pic1.jpg pic2.jpg pic2.jpg pic2.jpg pic3.jpg
    Lines broken for clarity.  Instead have command all in one line.
    This simply repeats the second frame, three times. The .MOV format might 'optimize away' the second and third frame from the final file, but I would not count on it.
    Of course, a far better way to animate images (with transition effects, full control over time, and all the bells and whistles) is to load the images into memory and create the slide show using the Java 2D abilities, mostly found in the Graphics class.

  • Wait for undefined amount of time

    Hello All,
    I have a requirement, where in I would want my activity in the workflow to wait for an indefinite amount of time. Then when a certain activity occurs, I would like to complete the 'waiting' activity.
    So lets say I have the following process with 2 activities(A and B)
    ----------> A ----------> B(wait for undefined amount of time)------------->End
    B needs to wait for some time, which I do not know.
    Then when another event( PL/SQL activity) occurs, I need the event to trigger of the waiting activity B, to completion.
    How can I acheive this?
    Thanks in advance.
    PHK

    Luiz,
    Lets say I have the following:
    -------->A---------->B(needs to wait)-----No------>D----> END
    \ Yes
    C-------------->END
    B is the activity which needs to wait. It has a PL/SQL function assciated with it.Lets say I have a result type of YES/NO associated with activity B. As soon as the workflow engine encounters activity B, it will execute the function associated with it. Lets the function ends with a result_out => YES, then immediatly C will be executed.
    So setting a result type will not help. I need to wait at step 'B'
    Regards,
    PHK.

  • My wifi network is 802.11n but there are times changing for 802.11g, and have to restart ... after the update for Mountain Lion

    My wifi network is 802.11n but there are times changing for 802.11g, and have to restart ... after the update for Mountain Lion...  Help!!!
    Several problems with Mountain Lion, APP STORE (login/logout error), WIFI(802.11n for 802.11g), MAIL (horrible)... Apple, what is happening?   

    Do a factory reset .. nothing will be deleted from your backups and you will be able to get access to them again.
    The Factory Reset Gen1-4.
    Unplug your TC. Hold in reset. and power the TC back on.. without releasing reset for about 10sec. When the status light flashes rapidly; release it.
    Be Gentle! Feel the switch click on. It has a positive feel..  add no more pressure after that.
    TC will reboot after a couple of minutes with default factory settings and will wipe out previous configurations.
    No files are deleted on the hard disk.. No reset of the TC deletes files.. to do that you use erase from the airport utility.

  • Which Mac Pro? More cores=slower speeds? And most of us know the speed matters or FPU for music and I don't understand the faster is for the least amount of procs. And while I get the whole rendering thing and why it makes sense.

    Which Mac Pro? More cores=slower speeds? And most of us know the speed matters or FPU for music and I don't understand the faster is for the least amount of procs. And while I get the whole rendering thing and why it makes sense.
    The above is what the bar says. It's been a while and wondered, maybe Apple changed the format for forums. Then got this nice big blank canvas to air my concerns. Went to school for Computer Science, BSEE, even worked at Analog Devices in Newton Massachusetts, where they make something for apple. 
    The bottom line is fast CPU = more FPU = more headroom and still can't figure out why the more cores= the slower it gets unless it's to get us in to a 6 core then come out with faster cores down the road or a newer Mac that uses the GPU. Also. Few. I'm the guy who said a few years ago Mac has an FCP that looks like iMovie on Steroids. Having said that I called the campus one day to ask them something and while I used to work for Apple, I think she thought I still did as she asked me, "HOW ARE THE 32 CORES/1DYE COMING ALONG? Not wanting to embarrass her I said fine, fine and then hung up.  Makes the most sense as I never quite got the 2,6,12 cores when for years everything from memory to CPU's have been, in sets of 2 to the 2nd power.  2,4,8,16,32,64,120,256,512, 1024, 2048,4196,8192, 72,768.  Wow. W-O-W and will be using whatever I get with Apollo Quad. 
    Peace to all and hope someone can point us in THE RIGHT DIRECTION.  THANK YOU

    Thanks for your reply via email/msg. He wrote:
    If you are interested in the actual design data for the Xeon processor, go to the Intel site and the actual CPU part numbers are:
    Xeon 4 core - E5.1620v2
    Xeon 6 core - E5.1650v2
    Xeon 8 core - E5.1680v2
    Xeon 12 core - E5.2697v2
    I read that the CPU is easy to swap out but am sure something goes wrong at a certain point - even if solderedon they make material to absorb the solder, making your work area VERY clean.
    My Question now is this, get an 8 core, then replace with 2 3.7 QUAD CHIPS, what would happen?
    I also noticed that the 8 core Mac Pro is 3.0 when in fact they do have a 3.4 8 core chip, so 2 =16? Or if correct, wouldn't you be able to replace a QUAD CHIP WITH THAT?  I;M SURE THEY ARE UO TO SOMETHING AS 1) WE HAVE SEEN NO AUDIO FPU OR PERHAPS I SHOULD CHECK OUT PC MAKERS WINDOWS machines for Sisoft Sandra "B-E-N-C-H-M-A-R-K-S" -
    SOMETHINGS UP AND AM SURE WE'LL ALL BE PLEASED, AS the mac pro      was announced Last year, barely made the December mark, then pushed to January, then February and now April.
    Would rather wait and have it done correct than released to early only to have it benchmarked in audio and found to be slower in a few areas- - - the logical part of my brain is wondering what else I would have to swap out as I am sure it would run, and fine for a while, then, poof....
    PEACE===AM SURE APPLE WILL BLOW US AWAY - they have to figure out how to increase the power for 150 watts or make the GPU work which in regard to FPU, I thought was NVIDIA?

  • I recently purchased QuickTime 7 Pro to convert avi files to mov files for editing on Imovie. However, QuickTime won't play the files. How can I get them to play and how can I convert them to mov files?

    I recently purchased QuickTime 7 Pro to convert avi files to mov files for editing on Imovie. However, QuickTime won't play the files. How can I get them to play and how can I convert them to mov files?

    I recently purchased QuickTime 7 Pro to convert avi files to mov files for editing on Imovie. However, QuickTime won't play the files. How can I get them to play and how can I convert them to mov files?
    Both the AVI and the MOV file extensions refer to the file container and not the compressed data the file contains. Both are generic file containers in that each may contain any valid combination of audio and/or video data that is compatible with the codec component configuration of the system on which the file was created. On the other hand, whether a file is playback compatible, conversion compatible, and/or edit compatible depends on the data actually contained in the file container. So, you are basically dealing with two separate issues here—the container and what is inside it.
    Basically, if you want to make your files ediit compatible with iMovie, you must change your file container to one that is acceptable to iMovie and convert the data to edit compatible audio and/or video compression formats as may be necessary. The best approach is to determine what codecs were actually used to create the original AVI files and add them to your system if possible. In most cases a codec package like Perian can be added to your system's codec component configuration to may the AVI file playable. Once they are playable, in the QT 7 app then they can be chnged or converted to file types and compression formats that can be edited in iMovie. (While Perian handles most codecs commonly used to create AVI files, it does not handle all possibilities and, while the Perian codec package still works under cureent Mac OS versions, its development group has decided to drop further development/support of the package.)
    Background: AVI is a file container originally developed by Microsoft back in 1992 but for which official support was discontinued about 11 years. Despite its limitations, Windows users still tend to use this file based on its open source ease of use and generic nature, thus, making its use so popular that most users are unwilling to switch to more modern but less generic file types. Since some AVI legacy compression formats have never been transcoded for the Mac or use beyond OS 9 or OS X PPC platforms, it is often important to know what specific compression formats are contained in the AVI file to know which codecs to add to your system and which not to add in order to avoid possible codec conflicts.
    You can use many different converters to convert AVI files to iMovie edit compatible files. Most third-party apps contain their own buit-in codecs which do not relay on the Mac codec component configuration. Free ones, like HandBrake, usually have limited conversion capabilities while those that have more varied outputs are usually commercial in nature and will cost you additional cash. QT 7 Pro or the free MPEG Streamclip app allow you to access you own system's component configuration and use any available codec component like DV, AIC, MPEG-4, H.264, Photo JPEG, etc.—all of which are iMovie compatible for editing purposes—but only after making the AVI file QT 7 player compatible.
    In order to determine what compression formats wewre used in your AVI files you can
    1) Try checking the Finder "Info" window,
    2) Use the "Inspector", "Media Info", or "Properties" window of any player app that will open the file, or
    3) Use a general media utility app like "MediaInfo" to read the file characteristics.

  • My wifi button is frezon and I tried turning my phone off for a period of time and reset my phone but the button is still frezon it want slide over to turn on my wifi. Is there any other way to fix without going to apple to get it fixed?

    My wifi button is frezon and I tried turning my phone off for a period of time and reset my phone but the button is still frezon it want slide over to turn on my wifi. Is there any other way to fix without going to apple to get it fixed?

    Hey Posada143, You can still try the rice thing, but do not expect much, as roaminggnome has stated. The rice only works if you do it ASAP and leave the iPod off-- do not attempt use, turn on or charge until it is completely dried out. This is probably academic at this point but remember this for the next time: The drying can take 10 days. You put the uncooked rice and iPod in a sealed bag, change the rice every couple of days. This creates a low humidity environment and draws the moisture out of the iPod, but it takes time. Turn your iPod on to earlier, and you run the risk of shorting out, damaging the components inside. Even if done correctly it can spotty. If you do get the iPod to work (and this may require Resetting, Restoring or attempting to place it in DFU recover mode) the first thing you do is make backups, because you never know how long it will continue to work. As for your pictures, if you can't get your iPod to work, you can try data retrieval companies, however; there is no guaranty it will work and it tends to be very expensive. In the future get in the habit of as making backups, because you just don't know. And invest in and use a water tight case. Hope this helps, Good luck. Cheers.

  • When I add a while loop to the vi "niScope EX Multi-Device Configured Acquisition (TClk)" to acquire data for multiple times, it works but it runs very slowly.

    Because I want to acquire the similar data for multiple times and then take an average to increase SNR, I add a while loop to the vi "niScope EX Multi-Device Configured Acquisition (TClk)".  It works but it runs very slowly (about 1 sec for each iteration). I think I had put the while loop at a wrong position, which makes the vi run from the very beginning in each iteration. So I really want to know where should I put the while loop to improve the speed? I have attached all the vi and subvi.
    Thanks very much.
    Attachments:
    Multi-Device External Clocking (TClk).vi ‏1166 KB
    avgWfm.vi ‏15 KB

    Dear Zainykhas,
    Thank you for posting this to the discussion forums and for uploading some sample code.  I took a lok at the issue you have been having, and it is unclear to me as to why you have placed two for loops around the original while loop.  My understanding is that you want to use the original Sample.vi and want to execute this N times where N is the Max Freq divided by Interval so that you can scan for a range of frequencies.
    Why not just put Sample.vi around one for loop and use the increment counter scaled by the interval to count up towards Max Freq and insert the desired Frequency into the cluster using Bundle By Name?
    Kind Regards,
    Robert Ward
    Applications Engineer, NI
    Attachments:
    Modified - RW.vi ‏48 KB

  • My headphones have broke for the third time will apple replace them after the third time (my warranty is still active)

    my headphones have broke for the third time will apple replace them after the third time (my warranty is still active)

    So i am likely to get new headphones? &amp; yeah personally i think i do handle them with care, i have no idea how they keep messing up. Btw thank you for the reply.

  • How to code a parallel 'for loop' and 'while loop' where the while loop cannot terminate until the for loop has finished?? (queues also present)

    I've attached a sample VI that I just cannot figure out how to get working the way that I want.  I've labeled the some sections with black-on-yellow text boxes for clarity during the description that follows in the next few sentences.  Here's what I want:
    1) overall -- i'm intend for this to be a subVI that will do data acquisition and write the data to a file.  I want it to use a producer/consumer approach.  The producer construct is the 'parallel for loop' that runs an exact number of times depending on user input (which will come from the mainVI that is not included).  For now I've wired a 1-D array w/ 2 elements as a test case.  During the producer loop, the data is acquired and put into a queue to be delt with in the consumer loop (for now, i just add a random number to the queue).
    2) the consumer construct is the 'parallel while loop'.  It will dequeue elements and write them to a file.  I want this to keep running continuously and parallel until two conditions are met.
          i. the for loop has finished execution
          ii. the queue is empty.
       when the conditions are met, the while loop will exit, close the queue, and the subVI will finish. (and return stuff to mainVI that i can deal with on my own)
    Here's the problems.
    1)  in the "parallel for loop" I have a flat sequence structure.. I haven't had time to incorporate some data dependency into these two sequential sections, but basically, I just care that the "inner while loop" condition is met before the data is collected and queued.  I think I can do this on my own, but if you have suggestions, I'm interested.
    2)  I can easily get the outer for and while loops to run sequentially, but I want them to run in parallel.  My reasoning for this is that that I anticipate the two tasks taking very different amounts of time. .. basically, I want the while loop to just keep polling the queue to get everything out of it (or I suppose I could somehow use notifiers - suggestions welcome)...  the thing is, this loop will probably run faster than the for loop, so just checking to see that the queue is empty will not work... I need to meet the additional condition that nothing else will be placed in the queue - and this condition is met when the for loop is complete. basically, I just can't figure out how to do this.
    3) for now, I've placed a simple stop button in the 'parallel while loop', but I must be missing something fundamental here, because the stop button is totally unresponsive.  i.e. - when I press it, it stays depressed, and nothing happens.
    suggestions are totally welcome!
    thanks,
    -Z
    Attachments:
    daq01v1.vi ‏59 KB

    I'd actually like to add a little more, since I thought about it a bit and I'm still not quite certain I understand the sequence of events...
    altenbach wrote:
    zskillz wrote:
    So i read a bit more about the 'dequeue element' function, and as I understand it, since there is no timeout wired to the dequeue element function, it will wait forever, thus the race condition I suggested above can never happen!
    Yes, you got it!
    As I've thought about it a bit more, there's a few things that surprise me... first, the reason the 'dequeue element while loop' errors is not because there's nothing in the queue, it's becaues the queue has been released and it's trying to access that released queue...   However the problem I have is this --- Even though there's no timeout wired to the dequeue element, I still would think that the while loop that contains it would continue to run at whatever pace it wanted -- and as i said before.. most of the time, it would find that there is nothing to dequeue, but once in a while, something is there.  however, it seems that this loop only runs when something has been enqueued.  the reason I say this is illustrated in the next code sample MODv2 that's attached below.  I've added a stop button to the "queue size while loop" so the program runs until that is pressed.  I've also added a simple conditional in the "dequeue while loop"  that generates a random number if it a button is pressed... but this button is totally non-responsive... which means to me that the "dequeue while loop" isn't actually continuously running, but only when an element is added to the queue.  this still seems almost like the 'dequeue while loop" waits for a notifier from the queue telling it to run.  can you explain this to me? because it is different from what I expect to be happening.
    rasputin wrote:
    I tried to open your VIs but it doesn't work. LV
    is launched, the dialog box (new, open, configure...) opens and then...
    nothing. Not even an error message. I guess it isn't a problem of LV
    version or a dialog box would appear saying this. Could you, please,
    send a image of the code?
    Thanks,
    Hi Rasputin, I'm using LV8.  I assume that was your problem, but who knows.  I've attached a pic of of altenbach's solution since it's what I needed.
    thanks
    -Z
    Message Edited by zskillz on 10-20-2006 11:49 AM
    Attachments:
    daq01v1MODv2.vi ‏63 KB
    daq01v1MODpic.JPG ‏116 KB

  • Execute case structure a certain number of times within a while loop

    Hi guys,
    I was wondering if it was possible to execute a case structure a specified number of times within a while loop. Basically I'm running a camera where each iteration of the outer while loop displays a frame of a live video feed and I'd like to capture the next x amount of frames (specified by the user) each time the 'Start Capture' button is clicked. The block diagram within the case structure captures and saves an image frame. As the program is written right now, frames will continue to be captured until the 'Start Capture' button is clicked again. Instead of having to click the button again to stop the case structure from executing for each iteration of the while loop, I'd like it to only execute for the next x iterations of the while loop. Any help would be appreciated. Thanks.

    Hello Uxorious,
    A while loop has a iteration counter that gives an integer value of how many times the loop has iterated. You can utilise this to count the number of frames captured. I assume that the program could be running for any amount of time before clicking start capture, if that is the case then you will need to be able to detect when you have clicked the button and add the desired number of frames you wish to capture to the current loop iteration.
    If you use a shift register on the outer loop with the start capture button connected to it (inside the loop) you will be able to compare its current value to its previous value. If it changes from false to true then you can add the desired number of frames to it to give you the loop iteration value where you need to stop.
    Then you can compare the current loop iteration value to that number and once reached, you can use a property node to change the value of your start capture button back to false.
    One final thing, don't forget to initialise the shift register I suggested to false so that you don't run the risk of missing the first time you press the button.
    I hope that makes sense.
    Alistair
    Best regards,
    Ali Bailey
    National Instruments
    Don't forget to Kudos useful posts!

  • How do I make a table of contents for a collection of six short stories that is after the legal page and NOT in the front on an unnumbered page?

    How do I make a table of contents for a collection of six short stories that is after the legal page and NOT in the front on an unnumbered page?
    When I first started I made a title page and then pasted in my first story from a .TXT file. After cleaning up I went back to the front a couple of empty lines ahead of the story and typed in the story title.  Unlarged the font size and centered it, then

    You can't do that. This is what the Pages User Guide, downloadable from your Pages Help menu, says:
    Creating and Updating a Table of Contents
    Each table of contents (TOC) you create using a Word Processing template lists only the content that follows it, up until the next table of contents. If you want a master table of contents for the entire document, it must be the only table of contents, and it must be at the beginning of the document.
    You can do it manually though.

Maybe you are looking for

  • How do I upgrade iPhoto after upgrading to Mavericks

    how do I upgrade iPhoto after upgrading to Mavericks

  • How to remove files in Miscellaneous Packages

    Hello, I recently moved from another IDE to JDeveloper 10g. In doing so, I imported an existing J2ee application. All packages were imported, however, all files in all packages were also added to the Miscellaneous Packages node as well, which causes

  • Specific field issue

    I have an Idoc to File scenario. The Idoc has a field XYZ, the Idoc should be processed only if XYZ =1, if it is 2 then it should not be processed. Do we specify this condition in mapping ? How do we specify it ? Should we map this field to a field i

  • Time machine preparing forever and spotlight estimating indexing time

    hey guys, Im having two problems that seem to be related. time machine gets stuck on preparing with the following error in console: Jul 18 17:03:19 Macintosh-5 /System/Library/CoreServices/backupd[6926]: Waiting for index to be ready (905 > 0) Spotli

  • Syntax Error "Method was not declared or inherited in class"

    Dear all, I am seeing the following syntax error in one of the standard classes CL_ICCMP_BT_INRHISTRESULT_CN01 which says "Method "XYZ" was not declared or inherited in class". Need help to identify when this error would occur or where I should be ch