How to write to file at user defined interval

Hello
I am trying to find a way to take data samples from a stream of strain measurements that is input to Labview from a NI 9237. These samples must be written to a file for later analysis. The vi must be capable of recording a burst of data at a user defined interval and sampling rate.
For example record at 10Hz for 10 seconds every 15 minutes.
My attempt at doing this is attached (as you can probably tell see I am quite a beginner at Labview).
In my example I have used a random generator to simulate my data from the NI 9237. By using a for loop I have tried to get the vi to write 5 data points to the file. However it writes the same data point to the file 5 times, instead of 5 successive data points.
Ultimately I would like the vi to write data to the file for a period of time (10 seconds) instead of writing a defined number of data points.
Can anyone please advise how I should go about achieving this?
Many thanks
Solved!
Go to Solution.

I would create a separate task which is used to write the data. Data to be written to the file can be passed to this task via a queue. You could set values to determine how much data needs to be written and at what intervals. Your data acquisition can post data to the queue. Your queue can be configured so that it will only contain enough entries to hold the amount of burst data you want to save. Any additional data posted to the queue would be dropped. Your write task could be in a loop that periodically checks to see if your time interval has been met. When it does it can dequeue all the elements from the queue and write them to the file. It will go back to waiting for the timer to expire. Now that the queue is empty your data acquisition will be able to fill it again with the next set of data.
NOTE: When you have your logger task pull the data from the queue you should use the queue status vi to grab all of the data at once and then flush it. If you dequeue elements one at a time in a loop your data acquisition task will start filling it again before you have written everything out. This would result in more data getting written to file than you want.
Mark Yedinak
"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot

Similar Messages

  • How to apply dll file or user defined function in B1

    Dear all,
    I have dll file and user defined function which use for converting number amount to text of my language. I plan to create UDF to keep the result of function on A/R invoice and I will use this UDF on print layout desiner but I don't know how to apply my function on B1. Please kindly suggest.
    Thanks you in advanced.
    Angnam

    Hi Angnam,
    Check this link.
    Re: amount in words
    Thanks,
    Srujal Patel

  • How to pass external input to user-defined subclasses

    Hi all,
    [this might be a really trivial question] I would like to define a sub-
    class of JTable which get some external inputs: something similar to
    the following *not-working* example.
    *********************************************************************** import javax.swing.*;
    import javax.swing.table.*;
    public class RHJTable extends JTable
        public RHJTable(int rows, int columns, int externalinput)
            super(rows, columns);
        public Object getValueAt(int row, int column, int externalinput)
            return externalinput;
    What follows is the error message I get, which I assume it is due to
    my "externalinput":
    ??? Java exception occurred:
    java.lang.ArrayIndexOutOfBoundsException: 0 >= 0
    at java.util.Vector.elementAt(Unknown Source)
    at javax.swing.table.DefaultTableColumnModel.getColumn(Unknown
    Source)
    at javax.swing.JTable.getCellRect(Unknown Source)
    at javax.swing.JTable.valueChanged(Unknown Source)
    at javax.swing.DefaultListSelectionModel.fireValueChanged(Unknown
    Source)
    at javax.swing.DefaultListSelectionModel.fireValueChanged(Unknown
    Source)
    at javax.swing.DefaultListSelectionModel.fireValueChanged(Unknown
    Source)
    at javax.swing.DefaultListSelectionModel.changeSelection(Unknown
    Source)
    at javax.swing.DefaultListSelectionModel.changeSelection(Unknown
    Source)
    at
    javax.swing.DefaultListSelectionModel.removeSelectionIntervalImpl(Unkno
    wn Source)
    at
    javax.swing.DefaultListSelectionModel.removeSelectionInterval(Unknown
    Source)
    at javax.swing.JTable.checkLeadAnchor(Unknown Source)
    at javax.swing.JTable.tableChanged(Unknown Source)
    at javax.swing.JTable.setModel(Unknown Source)
    at javax.swing.JTable.<init>(Unknown Source)
    at javax.swing.JTable.<init>(Unknown Source)
    at javax.swing.JTable.<init>(Unknown Source)
    at RHJTable.<init>(RHJTable.java:12)
    Can anybody please suggest me the correct way of passing this external
    input?
    Thanks
    lor

    Thanks for this detail. Before getting into JTable
    etc...design suggestions, it would be helpful to know
    how the interaction between Java and MATLAB is
    supposed to proceed. OK: I'm developing a MATLAB GUI with an embedded JTable inside it: people write things in a user defined JTable (well, customized subclass of JTable).
    I would like to define this subclass not as MyJTable(int rows, int cols) but as MyJTable(int rows, int cols, int externalinput), but doing this gives me the aformentioned error.
    Simplest setting: MATLAB writes data to a file, and
    knowing the format of that file you are able to parse
    it in Java. I'm not using any kind of input or output file: simply, MATLAB calls a JTable subclass (i.e. I only have a .class file to work on).
    Problem arises when I would like to add some more input: I cannot say simply setValueAt(int externalinput) if the JTable can't get this input directly from MATLAB...
    I hope I did make myself a little bit more clear: solution must be trivial, but I'm spending a lot of time in it...
    Thank you very much for your interest.
    lor

  • How to make an applet load user-defined package?

    How to have an applet load user-defined package?
    I have packages in their own directories, and the applet compiles and links with them, by use of CLASSPATH env variable. But when it comes time to run, it ignores that and does not know where the classes (in the packages) are.
    If I don't use packages and put all code in one directory, runs fine. If I use an application, I can link with and load my packages.
    I know applets can't use things like CLASSPATH for security reasons, but still, they should be able to be compiled out of several packages, why do I have to put all code together??

    OK, for reference for future newbies, here's the answer:
    use CODEBASE attribute in your html file (if on Windows server, don't use drive letter but relative path to .html file, Unix style, and put all your .class files beneath that, for example, in your .html file
    <applet
    CODEBASE="..\class
    and then have package bar Bar.class file, in ..\class\bar

  • How to write text file in Shockwave?

    Does anybody know how to write text file in Shockwave to
    user's disk?
    Thanks in advance.

    Those Xtras can wreak to much havoc when used with the wrong
    intent.
    What you can do is write with setpref and store a list of
    saves and the
    saves itself seperatly. Then you'd have to build your own
    save/open
    dialog to let the user:
    * pick a previously saved file to load or overwrite
    * have the user type the name of a new file to save.
    Only thing that remains is that the user cannot decide where
    the files
    are saved.
    Manno
    SiuLinda wrote:
    > Thanks a lot for your reply.
    > Yes, cookies is good but I have to write a program to
    save the text file in
    > where the user wants, user can open these files later if
    they like, like using
    > Filextra and Fileio, but I found all of these xtras seem
    to be not supported in
    > shockwave.
    >
    Manno Bult
    [email protected]

  • How do i share files between users

    I would like to know how to share documents (files) between users on my iMac.   Any suggestions would be welcome.

    Choose Go to Folder from the Finder’s Go menu, provide /Users/Shared/ as the path, and drag them there.
    (117100)

  • How do I share files between users on the same Macbook pro?

    I have created different users on my new Macbookpro, but I can't seem to share files between two users. Help how do I share files between users on one laptop? eg. a pdf file that I want to grab from my user x and use it on user y, thanks.  By the way I have already tries going into system preferences, sharing folder, then turning on file sharing and that didnt work. thanks

    From the Help Menu using the search criteria Drop Box

  • How to write WSDD file to deploy web service

    I write a server code,I want to deploy it as service,but I don't know how to write WSDD file?I use AXIS and SOAP
    I need help,thanks a lot.
    Regards
    William
    2.24

    Yes, put your wsdd with your class files. But if you want AdminClient to work correctly, be sure all environement variables are set correctly.
    Me, I never use it, I prefer to modify directly the server-config.wsdd

  • How to write a file using mod pl/sql

    hi,
    i am having a submit button in my procedure. which should inturn create .sql file in a file path.
    is there any way to create a fileusing htp and htf methods.
    Thanks in advance
    Hari

    >
    i am having a submit button in my procedure. which should in turn create .sql file in a file path.
    is there any way to create a file using htp and htf methods.
    >
    Why are you wasting your time coding from scratch using the PL/SQL Web Toolkit instead of the APEX framework?
    From Re: how to write a file using mod pl/sql it appears that you are not using APEX, so a number of the approaches APEX offers are not relevant. You appear to be looking for a file download solution using the <tt>wpg_docload.download_file</tt> method, such as:
    create or replace procedure download_file (
        p_filename  in     varchar2
      , p_mimetype  in     varchar2
      , p_content   in out nocopy blob)
    is
    begin
      -- Set up HTTP header.
      -- Use "application/octet" as default MIME type.
      owa_util.mime_header(nvl(p_mimetype, 'application/octet'), false);
      -- Set the size so the browser knows how much to download.
      htp.p('Content-length: ' || dbms_lob.getlength(p_content));
      -- Filename will be used as default by the browser in "Save as..."
      htp.p('Content-Disposition: attachment; filename="' || p_filename || '"');
      -- Close header.
      owa_util.http_header_close();
      -- Stream the file content to the browser.
      wpg_docload.download_file(p_content);
    end download_file;

  • How to select all files in "user dir" (LastAccessedDirectrory) using applet

    Hi,
    Can anyone tell me " How to select all files in "user dir" (Last Accessed Directrory) using applet"?
    For this which method in applet used?
    Thanks in Advance.

    1) Do you want "user dir" (watever that is) or do you wnat the last accessed directory? Last accessed by what/whom?
    2) Applets can't access the local file sytem, and for good reason, unless they're signed and the client has given permission.

  • How to write certain file On jCD through Java

    hi all,
    I got big problem in java , would anybody tell me how to write certain file onto CD through java. Is there any API available for this.
    Thanks in advance
    --Harish                                                                                                                                                                                                                                                                                                                                                               

    You might check this thread.
    http://forum.java.sun.com/thread.jspa?threadID=212748&tstart=90

  • How to read and write data to a user defined table?

    I have created a srf with 2 edit box and a ok buttin, I want to insert data to the user defined table i created using sql query while i press OK button..
    Please provide the complete code to insert and select da from the user defined table.

    Hi,
    You can use the code below.
    Dim ret As Long
    d
    Private Sub Add_Table_Click()
        Dim oUserTablesMD As SAPbobsCOM.UserTablesMD
        Set oUserTablesMD = oCompany.GetBusinessObject(oUserTables)
        ' When adding user tables or fields, use a prefix
        ' identifying your partner name space. This will
        ' prevent collisions from different partner add-ons
        ' SAP's name space prefix is "BE_"
        'Set the two mandatory fields
        oUserTablesMD.TableName = "T1"
        oUserTablesMD.TableDescription = "Table1"
        'Add the table (which contains 2 default, mandatory fields, 'Code' and 'Name')
        ret = oUserTablesMD.Add
        If ret <> 0 Then
            oCompany.GetLastError ret, Str
            MsgBox Str
        Else
            MsgBox "Table: " & oUserTablesMD.TableName & " was added successfully"
        End If
    End Sub
    Private Sub Add_UDF_Click()
        Dim oUserFieldsMD As SAPbobsCOM.UserFieldsMD
        Set oUserFieldsMD = oCompany.GetBusinessObject(oUserFields)
        oUserFieldsMD.TableName = "T1"
        oUserFieldsMD.Name = "AlbUDF"
        oUserFieldsMD.Description = "Albert UDF"
        'Add the field to the table
        lRetCode = oUserFieldsMD.Add
        If lRetCode <> 0 Then
            oCompany.GetLastError ret, Str
            MsgBox Str
        Else
            MsgBox "Field: '" & oUserFieldsMD.Name & "' was added successfuly to " & oUserFieldsMD.TableName & " Table"
        End If
    End Sub
    Private Sub Add_Data_Click()
        Dim oUserTable As SAPbobsCOM.UserTable
        Set oUserTable = oCompany.UserTables.Item(1)
        oUserTable.GetByKey ("T1")
        'Set default, mandatory fields
        oUserTable.Code = "A"
        oUserTable.Name = "Albert"
        'Set user field
        oUserTable.UserFields.Fields.Item("U_AlbUDF").Value = "1"
        oUserTable.Add
        If ret <> 0 Then
            oCompany.GetLastError ret, Str
            MsgBox Str
        Else
            MsgBox "Value to field: '" & oUserTable.UserFields.Fields.Item("U_AlbUDF").Name & "' was updated successfuly to " & oUserTable.TableName & " Table"
        End If
    End Sub
    Regards,
    Noor

  • How do I move files in Users/Shared instead of copying?

    I cannot move any files in /Users/Shared, even to other folders within Shared.  Dragging a file or folder in /Users/Shared shows the green "+" copy icon and creates a copy even if I hold down CMD while dragging.  Is this normal behavior?  How do I move a file instead of copying within /Users/Shared?  I was attempting this from an account with admin privileges and had read/write access to both source and destination sub-folders.  Any thoughts how to fix this?  I've never seen this behavior before on earlier OS X versions.
    2013 iMac with Mac OS 10.8.5

    If you want to move a file from one folder to another on the same volume (hard drive), either drag the file(s) from the current folder onto the folder to which you want to move it or select the file(s) you want to move and copy (Edit>Copy or Command C) and then open the folder you want to place them into and paste (Edit>Paste or Command V).
    If the folders are on different volumes, say you want to move some files to your external hard drive, perform the same steps as above. However between volumes, the Mac copies files. This is to prevent accidental erasure. You'll then need to return to the old folder and erase the files (drag to the trash can on the Dock or Command delete key).

  • Modifying .PRM file for user defined database functions

    Hi,
    Currently we have the BOXI 3.1.8 Universe in oracle database and we are planning to migrate to SQL server 2008.And the universe contains few oracle functions and user defined functions in the universe objects.
    In the way of migration we are planning to have both Oracle and SQL Server database connecting to single universe. To make the universe generic we have identified the objects using user defined functions and trying to push it to the database.
    Since there are a few differences in the way oracle and SQL Server functions are invoked, we have decided to edit the .PRM files available in the path D:\Business Objects\BusinessObjects Enterprise 12.0\win32_x86\dataAccess\connectionServer\jdbc , so that we have a common way of invoking the functions.
    Invoking functions:
    SQL Server : <SchemaName>.<function>
    Oracle: <function>
    1.Is there any problem if I edit the .PRM?
    2.Whether these changes will work fine?
    3.Whether the reports will run fine if I use those objects in the reports?
    Thanks,
    Lavanyaa

    Hi Lavanyaa,
    The PRM files actually state the functions that are normally available in a database, including the standard format.
    They are what drives the list of functions available when you build the SELECT definition or CONDITION definitions in Information designer... The fact that a function needs aggregation or/not is also determined in there.
    However:
    The SQL that you provide in the universe is what will be sent to the database and that must be 'understood' by the database.
    So it's not as simple as changing the PRM file and you will be able to speak 'universal' SQL in your universes.
    Fortunately:
    That complexity is taken away from you when you create a multisource database.
    You will speak 'data federator' SQL in the universe. Data federator will take care of translating it to the right syntax for each database. Notice you will probably need some customization to determine how a SQL will be handled when you need to query two databases, as the default is not automatically the best way performance wise.
    Hope this helps,
    Marianne

  • How to provide value to a User Defined field thru java code

    I am using OIM 11.1.1.5.
    I have a user defined field called Unique-Customer-Number. This field need to be pre-populated during user creation (using OIM Web UI) and the value comes from a java code.
    Can any of you tell me the high level steps to implement this.
    Thanks!
    Kabi

    Thanks Rajiv,
    I just followed everything on metalink 1262803.1. My console shows the followings during Metadata import.
    weblogicImportMetadata.bat :-
    Starting import metadata script ....
    Please enter your username :weblogic
    Please enter your password :
    Please enter your server URL [t3://localhost:7001] :t3://10.10.99.99:7001
    Connecting to t3://10.10.99.99:7001 with userid weblogic ...
    Successfully connected to Admin Server 'adm_server01' that belongs to domain 'server01'.
    Warning: An insecure protocol was used to connect to the server. To ensure on-the-wire security, the SSL port or Admin port should be used instead.
    Location changed to domainRuntime tree. This is a read-only tree with DomainMBean as the root.For more help, use help(domainRuntime)
    Disconnected from weblogic server: adm_eimsdv1s01
    End of importing metadata script ...
    Exiting WebLogic Scripting Tool.
    How I will I know that my plugin/ event-Handler is registered successfully. Is there any screen where I can see all registered plugins ?

Maybe you are looking for

  • GetString returning 0.0

    How do I solve the problem with ResultString.getString returning 0.0 instead of 0. I retrieve data from a column of type number(10). Rickard Eneroth WM-data [email protected] null

  • Which OS X?

    I'm running 10.6.8 on two iMacs and a Macbook Pro. I haven't had any particular reason to upgrade to Lion, or to Mountain Lion, until I discovered some of the value in the new Bento 4, which provides a full version for the iPad (we have both iPhones

  • Photoshop CS3 batch exporting

    Hello, I have 1 big PSD which has many groups and nested groups which contain layers. I want to export all individual layers in the PSD to transparent PNGs WHILE also preserving the group structure within the PSD. So the result should be that when I

  • ODI Interface execution hanging

    Hi, suddenly some interfaces execution hanging, what is the reason for this issue, and how i can overcome this issue? thanks

  • How to create an exe file in java

    hi all, i am trying to create exe file for myapplication plz helpme out in this