Write to measurement file at every n iterations

Hi guys,
I would like some help with saving data in labview 2010 SP1 (base development system). I am using a "Write to measurement fil express VI" inside a while loop and the data out from the DAQmn Read is wired to the signal in of the "Write to measurement fil express VI".
The way I have wired it is the VI saves the data as a text file after it has recorded 100 samples (the nuber of samples to read in this case was set to 100). I would like to know if there is a way to control the rate at which the express VI saves the data. As in, I want the express VI to save the data at specified time interval or at every nth iteration. I have attached the main VI and its 2 sub-VIs for reference. Please let know if anyone can help me resolve this issue. Thank you for your time and inputs in this regard.
Raj

Robert,
First, you must understand that the above code resides inside a loop. The blue square i terminal is known as the iteration terminal. It provides the current loop iteration count, starting from zero.
The first input (x) to the Quotient & Remainder Function comes from this iteration count (i) terminal of the loop.
The second input (y) to the Quotient & Remainder Function comes from the control N.
We wish to write to the measurement file every N iterations of the loop. If we take our current iteration count (i) and divide by our desired N, every Nth iteration of the loop, the remainder will be zero. For all other iterations, the remainder will be non-zero.
That being said, we check the remainder and compare it to zero. If it is zero, we will send a True value to the Enable terminal on the Write To Measurement File Express VI. Any time a True value is sent, we will write to file. Anytime a False value is sent, nothing will be written to the file.
The green new_file input on the Write To Measurement File Express VI is used when the "Save to series of files (multiple files)" radio button is selected in the Configure dialog box of this Express VI. When "Save to one file" is selected, this option does not apply, and so it is not included in the input list, which is why you are not seeing this.
This new_file input is used to tell the Write To Measurement File Express VI when to start writing to a new file.
 

Similar Messages

  • Does anyone know how to save waveform data (Write to Measurement File) with a variant iteration?

    I'm using LV8.5.1

    I would pull your save data loop to it's own loop then make it event driven like I did in the example. This is just an example and there are probably ways to make the code better and faster but I am just trying to give you an example that we can build on. I am not reall sure what you itterations was for other than to give your loop enough time to save. By seperating the two loops the save no longer depends on the data acquisition loop.
    Tim
    Johnson Controls
    Holland Michigan
    Attachments:
    Parts.vi ‏61 KB

  • Write to Measurement file wil not write data daily

    I have been using the Write To Measurement File express VI to record daily values. The express VI is no longer saving daily files or is checking for file size. WTF. Does anyone have a more bullet proof way of saving data daily with a single header for the day?
    Thanks,
    Matt

    MS UCD wrote:
    Ravens Fan,
    So to clarify, I meant local variable instead of shared variable.  Shared variables will come into play when I construct the real-time embedded program on the cfp-2120 controller. Thanks for the clarification. So are you on the clock for all this?
    Sometimes yes, sometimes no.  Since today is a holiday, I'm off the clock.
    Anyways, so if I need to have the user see the values on the front panel and also record the values later, how do you suggest one does such a thing other than writing an indicator and then making a local variable that is then recorded?
    The local variable has nothing to do with recording the values later.  It is just a way of accessing a control or indicator in more than one part of the program.  If you used shared variables (and I think you would need to have the DSC module to have this functionality), you could write to the shared variable and have it set up to log its values to the Citadel database.  It is a built-in method of logging that just requires configuration of the shared variable, no additional programming would be needed.  Otherwise you will need to add the code to write to a log file like you are doing now.
    The new/old mechanism for checking the date has brought the adequate functionality I was looking for- mainly new files for each day.
    With respect to the race condition you mentioned, could a sequence structure be used to write the local variable to the output array? In essence, I would calculate the scaled values and then write them to the data array. Another solution could be a control in the last case that then is used to initiate a case structure in which the shared variables for the data acquisition iteration are then recorded in the output array.
    A sequence structure (and a flat sequence is preferable to a stacked sequence for code readability and maintainability) would guaranteed that one section of code completes before another begins.  However, it is still preferable to use wires.  Wherever you are wiring to a local variable, just send the wire to the border of the while loop.  Feed the wire from that tunnel to the build array function and eliminate the local variable that you are reading there.  Your case structure in a while loop is really just functioning like a stacked sequence structure.  Every iteration of the while loop executes the next case in the case structure.  If you are sequencing through the data values in the same order that you are building them into an array outside of the loop, you could actually build the array element by element inside each case structure and use a shift register on that array to carry the data from one iteration of the while loop to the next.  Then once you while loop is done, the array has already been built.  If by chance you are acquiring the data in a different order then you want to build it into and array, then the array functions could get much more complicated inside the case structures.  But you could initialize the whole array before the case structure, and use replace array subset to replace each specific element as you acquire it.
    I am interested in the producer/consumer arrangement you speak of. Do you have an example you could send me that shows this operating?
    Go to File then New....   Look under frameworks, design patterns, and Producer/Consumer Design pattern (Data).  Also search the forum for producer/consumer and I'm sure you'll see plenty of examples.
    As for the Time Signal controls being located in the Labview abyss, what can I say? Every learning experience has a few bugs. ; - ) If the Time Signals are constants what effects on the time in the chart will this have?
    Since the time controls are way off, I assume that the program user will never actually go out into the space of the front panel to find them and change them during the execution of the code.  (I am also assuming that those controls never get changed programmatically by writing to a local variable or property node or they are not part of the connectory pane where this VI is called as a subVI in another one that passes in a time stamp on every call.)  If they never change, then they are effectively constant.  Changing them into constants would clean up the code and make it slightly more efficient, but would not appear to execute any differently.
    Thanks for helping this novice out!
    Regards,
    Matt

  • How to put the proper header at each column in write to measurement file (.lvm) ?

    Hi,
           i would like to know one thing about the write to measurement file. Can i put the proper header at each column in write to measurement file (.lvm) ? and how can i do for it ? Could you show me a way to make it ?
    i am looking forward your kindly reply.
    thank you so much ..
    best regard,
    roxy

    Hi Mike,
                  Thank you very much for your help. It works .
    By the way, i would like to ask you about setting time interval. In the pic, X_Value column is for time column
    i would like to ask that when i use the write to measurement file, there got the x column that show time inside the excel file. In this column, i would like to set the time interval at every 210ms .The data may come in every msec but i just want to record the data at every 210ms .  for example, 210ms-420ms-630ms ..etc. how can i set it ?
    One more thing .. can i do it in graph as well ?
    i am looking forward your kindly reply.
    Thank you for your time.
    Best Regard,
    Roxy

  • Write to measurement file timing

    I am trying to make a VI that allows the user to turn on and name channels through the front panel. After the user has configured the channels, they can push a button and record voltages from the enabled channels and save them using the "Write to Measurement File".vi.  I would like the user to be able to record a measurement file that is consistent in length each time they push the button...in this case, 5 seconds of data.  The current VI doesn't appear to be doing this...everytime I push the record button, the data gets recorded for 0.045 seconds.  Apparently I must be missing something as this isn't behaving how I expected it to.  See attached VI.
    Attachments:
    Select Channel rev 3.vi ‏244 KB

    It waits 5 seconds then saves the last 10 samples.  Because that is the way you programmed it.  The while loop returns only the data from the last iteration.
    Two ways to do what you want: 1. Read 5 seconds * 200 samples/second = 1000 samples.  No loop required.
    2. Read 10 samples at a time and accumulate the data until you have 5 seconds of data.  To avoid memory reallocations the way to do this is to Initialize an array with 1000 elements outside the loop. Wire it to a shift register.  Inside the loop Read the samples and use Replace Array Subset to put the new data into the initialized array. Wire the output of the shift register to the file VI.
    You generally should not put any time consuming code inside an event structure.  Read the caveats in the detailed help for the event structure.  Consider a Producer/Consumer architecture.
    Lynn

  • How to populate column titles for y values when using Write to Measurement File Express VI with a tab delimited text-based .lvm file?

    The .lvm file generated by the Write to Measurement File Express VI includes column heading titles for the y values, but they are a default value of "untitled".  See attached example of a sample file when opened in Excel, the values in question are highlighted.  Is there a way to specify the column titles when the file is written?
    This is a similar question to this posting, which received a work around response to use the Write to Spreadsheet File.vi, rather than a solution when using this VI.
    Message Edited by Hightop Raven on 05-02-2007 03:37 PM
    Attachments:
    column_titles.gif ‏13 KB

    Sorry for the late reply.  I was out of the office Friday.
    You can do it, but the code can get rather ugly.  Under the hood, the dynamic data type (the dark blue wire) is an array of waveforms.  In your case, the scalar values you convert to a dynamic data type are being converted to an array of waveforms, each waveform having one element.  You have two options.
    Explicitly convert your scalars to one-element waveforms (t0=0, dt=1) and add the title before conversion to a dynamic data type.
    Convert your dynamic data type to an array of waveforms and loop through them to add the column labels.  The conversion blocks are in the Signal Manipulation Express palette.
    I would recommend 2, since it is the easiest to add.  It is also the easiest to run only on the first iteration.  Just put a case selector around the loop, wire the selection to the While loop iterator, and set the case containing the label code to 0.  The default case simply passes through the dynamic data.
    My apologies for not including a screen shot.  I am in the process of upgrading my machine and can't run LabVIEW.  If you need one, let me know and I can post one tomorrow.
    This account is no longer active. Contact ShadesOfGray for current posts and information.

  • Write to measurement file

    Hello,
    I have to measure my spectrometer values every thirty seconds and have to write it to a text file. I need to create a new text file each time for writing my values. So i used the write to measurement File option for doing this. The problem is that this block measures the values only every one minute, but i need to measure the values every thirty seconds. Could any one help me out with this ?
    Thanks in advance
    Swarna

    Some issues you have for the timing part of your code:
    1. Use the Time has Elapsed output of the Elapsed Time VI.  It already does the comparison for you, so just use it.
    2. I'm pretty sure you want the Write Measurement File to be in the TRUE case.
    3. Use the AutoReset option on the Elapsed Time VI.
    But those do not point to a data point every 1 minute.  How long does it take your instrument to do the sweep before sending it to you?  I have seen some take a long time, so it is worth looking into.

  • Help with saving time stamps to "write to measurement file" excel format.

    I am having problems saving the timestamps from my data to the write to measurement express vi for excel.  My incoming data is converted from dynamic data to a 1d array for processing, which I understand you lose the time stamp data. I added a new array for time stamps but this array then cannot be converted back to the dynamic data that is requested to go into the write to measurement file express vi.  I would prefer to leave the data in an array to be saved rather than converting it to a waveform so is there any way to add the time stamps from my 1d array back into the write to measurement file? 

    I set it up to build a waveform now but I am still having issues with it saving the correct timestamp.  The time just incriments for every second (as it did before converting the dynamic data to the waveform). I attached a screenshot.  
    Attachments:
    waveform.png ‏36 KB

  • Write to measurement file will not ask for file name once as selected.

    When using the Write to Measurement file Express VI.  I select "Ask user to choose file" and "Ask only once" with the intention that the data from each iteration simply be appended to the chosen file.
    I select "Run continuous" and the VI asks for me to choose a file repeatedly anyway instead of just appending the first file.  Selecting "Write to one file" properly appends data to the file specified in the box.
    Am I doing something wrong?

    DianeS wrote:
    Personally I can't figure out why that particular button even exists (I'm told it's occasionally useful for debugging).  
    I find it useful if I am creating a subVI that is supposed to be a part of another VI.  No while, loop just some inputs and outputs as a function.  If I want to test it out stand alone and try a variety of inputs, then Run Continuous and change the inputs, then I see immediate feedback on the outputs.  Once I'm satisfied its working right, then there is no need to clean up.  Just save it and drop it in the large VI as a subVI.
    Beyond that, I see no need for Run Continuous.

  • How to change 'untitled' in 'write to measurement file' block

    Hello, when i use the write to measurement file function I can open up the data file as a txt. The data is shown in columns just like i want, but i want to change the column titles from Untitled1, Untitled2 etc... to something else. I dont see how to do this.
         Thanks
            - Dan

    Here is the only way I can figure, and this is using the Set Dynamic Data Attributes express vi.  Basically, I have 5 channels setup under a task in MAX, and since I'm not using the DAQ Assistant express vi (which, btw, can't access an existing task, as it only selects channels to create a new task), my tasknames don't get bundled in that nice little "Dynamic Data" wire.  Hence the Untitled column headers in what is written, and unnamed signals anywhere else its used.  Its a shame that we have such a convenient way to write a measurement file, but DAQread.vi is unable to output dynamic data.
    This is the only way I could think of to make it work; It's real simple, but looks real messy in the midst of my rat's nest of wires and vi's.  For every single channel you want to name, it seems you will need a separate instance of this Set Dynamic Data Attributes.  
    Attachments:
    Signal Attributes.JPG ‏38 KB

  • Hi am trying to save Data into a write to measurement file vi using a NI PXI 1042Q with a real time mode but it is not working but when i run it with uploading it into the PXI it save in to the file

    Hi am trying to save Data into a write to measurement file vi using a NI PXI 1042Q and DAQ NI PXI-6229 with a real time mode but it is not working but when i run it without uploading it into the PXI it save in to the file please find attached my vi
    Attachments:
    PWMs.vi ‏130 KB

     other problem is that the channel DAQmx only works at real time mode not on stand alone vi using Labview 8.2 and Real time 8.2

  • Labview 9.0: Error 1 occurred at Write To Measurement File

    Hi
    Our University recently got the latest version of Labview (9.0 32-bit) which I installed today.The labview file I am using (my6008v6.vi)  used to work fine with the older version (8.5 i think). My write-to-file VI is enabled at certain time intervals in order to log data. As soon as it is enabled for the second time I get the following error:
    Error 1 occurred at Write To Measurement File->Copy of murray6008v6.vi
    Possible reason(s):
    LabVIEW:  An input parameter is invalid. For example if the input is a path, the path might contain a character not allowed by the OS such as ? or @.
    =========================
    NI-488:  Command requires GPIB Controller to be Controller-In-Charge.
    I made a simple file (simplew2f.vi) to test this, with a button which I can press to enable/disable the writing of data. I am able to start writing data and then stop writing data but as soon as I try resume the writing the same error occurs.
    This confuses me greatly since this wasn't a problem using the old version and my Labview knowledge is minimal. Any help would be appreciated.
    Attachments:
    my6008v6.vi ‏214 KB
    simplew2f.vi ‏64 KB

    So, which VI are you having problems with?  Sounds like both...
    Okay... - sigh - where to start....   
    Well..  Let's start with a few comments. 
    1.  Try to stay away from the Express VI.  I know the Marketing guys at NI will not like me for saying so, but I am saying so.  They are a nice marketing feature that Grumpy Old Men like myself do not like.   They make it easy to write quick code..  And I will limit my comments to that.  (It's not your fault.. )
    2.  The wiring on your diagram is not clear or easy to read.  Yes, with additional time and double-clicking each wire I can tell where they are going.  However, a rule of thumb, alway wire from Left to Right.  Never right to left.  And do not run the wires under objects, even the ones you are wiring to.
    3.  simplew2f.vi:  You should put a small delay in the While Loop.  I ran it three times and it wrote to the files without error.  And yes, I used LV2009.
    4.  my6008v6.vi:  Avoid wiring from the top of the While Loop.  At frist, it looked like the data was coming out of the While Loop because the wires went to the left side of all the index node of the Index Array function.  
    You should set your Browse Option for the file path to "Files or Folders" and "New or existing".  I did that and I was not getting the error message you described.
    R
    Message Edited by Ray.R on 03-03-2010 08:33 AM
    Attachments:
    pathProperty.PNG ‏13 KB

  • Formatting the time stamp in "Write LabVIEW Measurement File"

    When I use the "Write LabVIEW Measurement File" vi to write data
    the files first column contains the number of seconds since the staart of the file
    How can I get the computer date and time or at least the time HH:MMS???
    Tom
    PS, And how can I put some sensible label on each columns in the file?

    Tom,
    The vi I'm attaching demonstrates how to use the computer system time for the timestamp on your LVM file. It takes a reading from the DAQ Assistant and applies a system time stamp. It's in version 7.1, but let me know if you need it in version 7.0.
    As for inserting meaningful column headers, you won't be able to do that with the express vi, but you could use the regular file i/o vis to create a file like that is similar to a LVM file, but is a little more customizeable and can be formatted however you like. The express vi is meant to be a quick solution, but does not offer all the versatility of the vis on the palette. I hope this helps you out. Have a good one, Tom!
    Tyler S
    Attachments:
    LVM_timestamp_7_1[1].vi ‏265 KB

  • Quickie: Write to measurement file VI, how to create new file?

    I am using the write to measurement file express VI in my code and I have wired into it a control that sets the location to save the measurement file
    The only problem is the measurement file has to exist first!! I cant for example, from the front panel, click the browse directory box, navigate to a folder and type in a name for the file. It just says file not found! Its like the file directory control is opening a file to save to, rather than creating a new file in that location
    How can I solve this?
    Solved!
    Go to Solution.

    Project attached
    If I go in browse options what do i do? Just chose new and existing files?
    Attachments:
    engine.zip ‏119 KB

  • Remove milliseconds from timestamp in write to measurement file

    I'm logging data to a binary tdms file using the write to measurement file express vi. I choose my x axis to be time and see that an absolute timestamp is written with millisecond precision. I only need to-the-second precision. Is there anyway to change this default behavior?
    Attachments:
    remove.png ‏10 KB
    remove.png ‏10 KB

    Where is your data coming from. When I open the express vi to look, it looks like the time format doesn't determine that, but the
    signal data cluster coming in does. So where does the data come from, and in what form?
    Putnam
    Certified LabVIEW Developer
    Senior Test Engineer
    Currently using LV 6.1-LabVIEW 2012, RT8.5
    LabVIEW Champion

Maybe you are looking for

  • Withholding tax fields in Vendor master is not avbl to config as sensitive

    Hi, I need to configure, fields in Withholding tax accounting as sensitive fields in Vendor Master. Table reference for Withholding tax is LFBW. But the fields from this table are not avbl for configuring in SPRO. It gives an error message as: This f

  • Trying to publish a new iWeb site to mobileme

    My son is part of a family account I have and he is experimenting with creating a blog using iweb Is publisihing on Mobileme still supported? We are trying to publish but it's selling us to sign in (and we are signed in) and can't progress further I

  • How to put record set in loop

    Using the follwing query select distinct code from oalr where code > '" & AlertCode & "' and  code<=('" & code & "') " i got 5 records eg :5603,5604,5605,5606,5607 record set fetching Ocode = CStr(rs4.Fields.Item(0).Value) Here  Ocode get only last r

  • How does this little white plastic stand work?

    I've got this little white (with a little grey part with the number 16 on it) thing which I think came with my iPod Touch 3G. I have no idea what to do with it. There is a hole in it that seems to be for the dock connector. But how do I use this?

  • Question about a /proc/pid/ctl read

    Hi, I'm trying to read some bytes from /proc/pid/ctl using PCREAD command, I attached a priovec_t struct like this:      priovec_t strc;      char buffer[100] = {0};      strc.pio_offset = atoi(argv[2]);      strc.pio_len = 100;      strc.pio_base =