Trying to write current aquired data to file while a continuous aquisition is occurring.

I have a vi named pj_pushbutton.vi in the attached library. The vi is aquiring data continuously. I have a button that when pushed will write the data to the file. It does this fine except that it seems to be writing the samples from the buffer immediately. I guess I want to aquire the latest samples not all the samples that are n the buffer so that I get the real time aquisition. When I push the button I have it set up to read the number of samples based on time on the front panel. I want to sample 2 seconds and it calculated the sample rate multiplies by the seconds to give me the number of samples. When I run the program the push the button to write the data to the file
it seems to be writing from all the recodes in the buffer not just the most current. So instead of taking 2 seconds to write the data it writes whatever is in the buffer immediately. How do I keep it from doing this? My file is attached in a zip. Thanks for your help.
Attachments:
filebutton.zip ‏719 KB

Hi HAL,
I don't have time to figure out exactly what you are asking but I can offer this tid-bit that may be handy to know.
"Delete from array" will by default return the last eelement in an array. This is ewasier and cleaner than iterating through all the elements and just keeping the last.
Add some comments (fre labels) showing me where to look if you want me to be of more help.
Ben
Ben Rayner
I am currently active on.. MainStream Preppers
Rayner's Ridge is under construction

Similar Messages

  • Is it possible to write a routine on excel file while loading data?

    Hi
    I am trying to load data from csv file(Excel flat file) into ODS, while loading data in to ODS, I need to check a condition if one Info Object in ODS is match with column C field in flat file then only the data should load, otherwise reject the data.
    any help is greatly appreciated.
    Thank you
    Harshan

    Hi Harshan,
    in your start routine:
    data: wa_ods type <name of active data ods table>,
          l_index type sy-tabix.
    loop at data_package.
    l_index = sy-tabix.
    select single * into wa_ods
    from   <name of active data ods table>
    where  <your condition>.
    if wa_ods-<fieldname> = <your condition>.
    continue.
    else.
    delete data_package index l_index.
    endif.
    endloop.
    In case of bad performance it might be necessary to post the ods-data to a internal table first and read the internal table instead of doing select single.
    Hope this helps!
    regards
    Siggi

  • I'm trying to write an email and import files that are in other emails I've been sent.  Some are attachments. How can I do this?

    Hello,
    I'm new to the mac world and would like to know how to compose an email including information from emails I've received.  I want to forward the contents of three emails to my a new email I'm composing.   One email has attachments and the others have typed info.  I know I can copy/paste but I'm not sure about the attachments.  Is it best to open them and copy them to the email?

    Save those attachments > Default location is the Downloads Folder.
    Then re-attach to your new email.

  • HT4796 How to retain original dates of files while migrating from PC to MacBookPro

    I migrated my Documents, Pictures, etc.  from my PC (Dell Latitude E6410) to the new MacBookPro (late 2013) by a hard connection (Thunderbolt to Ethermet adaptor) using the Migration Assistant. The transfer was OK, however, the dates of the Files (and individual Documents)  migrated now ALL have the date of migration!!!
    Is it possible to "retain" the original dates of the files during the migration process???

    its often the same going from PC to PC and mac to Mac if you use external media
    I do have one complicated suggestion. if you can get the two machines networking smoothly, you could run rsync scripts to sync them and maintain dates as best possible. I can do that via SMB to a network attached drive.
    But i cannto even try to my PC because its sharing rules are locked by corporate IT weasels
    Grant

  • NotSerializable error while trying to write arraylist

    I am getting a NotSerializable error while trying to write an arraylist to a file.
    Here's the part of the code causing problem
    File temp = fileOpenerAndSaver.getSelectedFile(); // fileOpenerAndSaver is a JFileChooser object which has been created and initialized and was already used to select a file with
    currentWorkingFile = new File (temp.getAbsolutePath() + ".gd");      // currentWorking file is a file object
    try
         ObjectOutput output = new ObjectOutputStream (new BufferedOutputStream(new FileOutputStream(currentWorkingFile)));
         output.writeObject(nodeList); // <-- This is the line causing problem (it is line 1475 on which exception is thrown)
         output.writeObject(edgeList);
         output.writeObject(nodesWithSelfLoop);
         output.writeObject(nextId);
         output.writeUTF(currentMessage);
         output.close();
    catch (Exception e2)
         JOptionPane.showMessageDialog (graphDrawer, "Unknown error writing.", "Error", JOptionPane.ERROR_MESSAGE);
         e2.printStackTrace();
    } As far as what nodeList is -- it's an arraylist of my own class Node which has been serialized and any object used inside the class has been serialized as well.
    Here is the declaration of nodeList:
         private ArrayList <Node> nodeList; // ArrayList to hold a list all the nodesLet me show you whats inside the node class:
    private class Node implements Serializable
         private static final long serialVersionUID = -4625153386839971250L;
         /*  edgeForThisNodeList holds all the edges that are between this node and another node
          *  nodesConnected holds all the nodes that are connected (adjacent) to this node
          *  p holds the top left corner coordinate of this node.  The centre. of this node is at (p.x + 5, p.y + 5)
          *  hasSelfLoop holds whether this node has a self loop.
          *  **NOTE**: ONLY ONE SELF LOOP IS ALLOWED FOR A NODE.
         ArrayList <Edge> edgeForThisNodeList = new ArrayList <Edge> ();
         ArrayList <Node> nodesConnected = new ArrayList <Node> ();
         Point p;
         boolean hasSelfLoop = false;
         int index = -1;
         BigInteger id;
                     ... some methods following this....
    }Here is the edge class
    private class Edge implements Serializable
         private static final long serialVersionUID = -72868914829743947L;
         Node p1, p2; // The two nodes
         Line2D line;
          * Constructor:
          * Assigns nodes provided as appropriate.
          * Also calls the addEdge method on each of the two nodes, and passes
          * "this" edge and the other node to the nodes, so that
          * this edge and the other node can be added to the
          * data of the node.
         public Edge (Node p1, Node p2)
              this.p1 = p1;
              this.p2 = p2;
              line = new Line2D.Float(p1.p.x+5,p1.p.y+5,p2.p.x+5,p2.p.y+5);
              p1.addEdge(this, p2, true);
              p2.addEdge(this, p1, false);
         }Here is the error I am getting:
    java.io.NotSerializableException: javax.swing.plaf.metal.MetalFileChooserUI
         at java.io.ObjectOutputStream.writeObject0(Unknown Source)
         at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source)
         at java.io.ObjectOutputStream.writeSerialData(Unknown Source)
         at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)
         at java.io.ObjectOutputStream.writeObject0(Unknown Source)
         at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)
         at java.io.ObjectOutputStream.writeObject0(Unknown Source)
         at java.io.ObjectOutputStream.writeObject(Unknown Source)
         at MyPanel.save(MyPanel.java:1475)
         at GraphDrawer.actionPerformed(GraphDrawer.java:243)
         I inentionally did not write the whole error stack because it was way too long and I ran out of characters. But line 1475 is where I do the writeObject call. I also goet some weird not serialized exceptions before on some other classes that are not being written to the file or are not part of the object that I am writing. I serialized those classes and now it's this unknown object that's causing problems.
    Edit: The problem may be due to the JFileChooser I am using to select the file as it is a non-serializable object. But I am not trying to write it to the file and in fact am just writing the arrayLists and BigInteger as objects to the file.
    Edited by: Cricket_struck on Dec 21, 2009 1:25 PM
    Edited by: Cricket_struck on Dec 21, 2009 1:32 PM
    Edited by: Cricket_struck on Dec 21, 2009 2:16 PM

    java.io.NotSerializableException: javax.swing.plaf.metal.MetalFileChooserUIThat's a Swing component and it is clearly related to the JFileChooser.
    I also get some weird not serialized exceptions before on some other classes that are not being written to the file or are not part of the object that I am writing.That's a contradiction in terms. If you get NotSerialzableException it means the objects are being written. So they are reachable from the objects you're writing.
    Edit: The problem may be due to the JFileChooser I am using to select the file as it is a non-serializable object.JFileChooser implements Serializable, but you're right, you shouldn't try to serialize it. But clearly this is the current problem. Somewhere you have a reference to it reachable via the object(s) you are serializing.
    I suspect that Node and Edge inner classes and that you aren't aware that inner classes contain a hidden reference to their containing class. The solution for serializaition purposes is to make them static nested classes, or outer classes.

  • Trying to write to a file that uses the current date as a portion of the path

    I would like to write to a data file that changes the path when the date changes. I am using the build path VI with the get date/time VI with the "/"'s removed from the string. I've tried using .txt in the pattern input and adding it in with the concatenate string VI. Either way I receive Error 7 File not found. Ifanyone has any thoughts on hoew to accomplish this I'd appreciate it. Thanks

    You have to check if the VI that create the file is setted to "create" or to "append" caracters on the file. I receive this error message when i am trying to use the "Write caracters to file.vi" and it was setted to append. You should use an converter to change the name of the file from String to Path. And you have to use a loop structure to check the date and append caracters on the file everytime is needed.
    Regards,
    Carlos

  • Trying to write data to a text file using java.io.File

    I am trying to create a text file and write data to it by using java.io.File and . I am using JDeveloper 10.1.3.2.0. When I try run the program I get a java.lang.NullPointerException error. Here is the snippet of code that I believe is calling the class that's causing the problem:
    String fpath = "/test.html";
    FileOutputStream out = new FileOutputStream(fpath);
    PrintStream pout = new PrintStream(out);
    Do I need to add additional locations for source files or am I doing something wrong? Any suggestions would be appreciated.
    Thank you.

    Hi dhartle,
    May be that can help:
    * Class assuming handling logs and connections to the Oracle database
    * @author Fabre tristan
    * @version 1.0 03/12/07
    public class Log {
        private String fileName;
         * Constructor for the log
        public Log(String name) {
            fileName = name;
         * Write a new line into a log from the line passed as parameter and the system date
         * @param   line    The line to write into the log
        public void lineWriter(String line) {
            try {
                FileWriter f = new FileWriter(fileName, true);
                BufferedWriter bf = new BufferedWriter(f);
                Calendar c = Calendar.getInstance();
                Date now = c.getTime();
                String dateLog =
                    DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM,
                                                   Locale.FRANCE).format(now);
                bf.write("[" + dateLog + "] :" + line);
                bf.newLine();
                bf.close();
            } catch (IOException e) {
                System.out.println(e.getMessage());
         * Write a new line into a log from the line passed as parameter,
         * an header and the system date
         * @param   header  The header to write into the log
         * @param   info    The line to write into the log
        public void lineWriter(String header, String info) {
            lineWriter(header + " > " + info);
         * Write a new long number as line into a log from the line 
         * passed as parameter, an header and the system date
         * @param   header  The header to write into the log
         * @param   info    The line to write into the log
        public void lineWriter(String header, Long info) {
            lineWriter(header + " > " + info);
         * Enable to create folders needed to correspond with the path proposed
         * @param   location    The path into which writing the log
         * @param   name        The name for the new log
         * @return  Log         Return a new log corresponding to the proposed location
        public static Log myLogCreation(String location, String name) {
            boolean exists = (new File(location)).exists();
            if (!exists) {
                (new File(location)).mkdirs();
            Log myLog = new Log(location + name);
            return myLog;
         * Enable to create the connection to the DB
         * @return  Connection  Return a new connection to the Oracle database
        public static Connection oracleConnectionCreation() throws Exception {
            // Register the Oracle JDBC driver
            DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
            //connecting to the DB
            Connection conn =
                DriverManager.getConnection("jdbc:oracle:thin:@myComputerIP:1521:myDB","user", "password");
            return conn;
         * This main is used for testing purposes
        public static void main(String[] args) {
            Log myLog =
                Log.myLogCreation("c:/Migration Logs/", "Test_LinksToMethod.log");
            String directory = "E:\\Blob\\Enalapril_LC-MS%MS_MS%MS_Solid Phase Extraction_Plasma_Enalaprilat_ERROR_BLOB_test";
            myLog.lineWriter(directory);
            System.out.println(directory);
    [pre]
    This class contained some other functions i've deleted, but i think it still works.
    That enables to create a log (.txt file) that you can fill line by line.
    Each line start by the current system date. This class was used in swing application, but could work in a web app.
    Regards,
    Tif                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • I am trying to write a heartbeat program which takes the current time and writes

    I am trying to write a VI that gets the current time and writes it to an XML file in this format.  YYYY-MM-DDThh:mm:ss[.s][Z|(+|-)hh:mm]
    I cant seem to get the operators on the format date/time string vi to work for concatenating the "-" between the year and month
    Anybody know how to do this one?

    You should not need to use special operaors for the format date/time string, the format should simply be"%Y-%m-%d"

  • HT5252 I tried to change my metadata date and got this   Aperture was not able to adjust the date and time of the original file "01769_p_h13ajyrm4bm0944.jpg" because it is locked or you do not have permission to modify it.

    I tried to change the metadata date.  It changed the date on my photo, but when I checked the box that said "also change my original file", it gave me this error message.
    Unable to change original file.  Aperture was not able to adjust the date and time of the original file “01769_p_h13ajyrm4bm0944.jpg” because it is locked or you do not have permission to modify it.
    Wassup?

    What is your Aperture version? The older versions of Aperture 3 had a problem to apply Metadata changes to the original file.
    If you are using the current version Aperture 3.4.5, try to repair the permissions on your Aperture library, if you have not already done so:
    Launch Aperture with the key combination ⌥⌘ held down and select "Repair Permissions" from the First Aid PAnel, that will appear.
    If that does not help, post back with more information on your original files - are the referenced or managed? Where is your Aperture library located? Since when do you have this problem? And what did you do directly before noticed the problem for the first time?
    Regards
    Léonie

  • I want to run my program with continuous aquisition and write data to file when a button is pressed and get the most recent samples from the DAQ board.

    This is an update to a question I asked earlier. I am still trying to solve the problem. I have included a zip file with a library file. The file to open in pj_pushbutton.vi. I have placed comments explaining the issues and problems in this vi and the subvi's.
    When I push my button to write the data to file I think it is writing the data that has already been stored in the buffer and writing to file all at once. I want the data that is taken from the DAQ board from the time that I press the Write File button. How do I do this?
    Attachments:
    pj_pushbutton.zip ‏692 KB

    Hi,
    1. In AI read, you need to set the Read/Search option to "Relative to End of Data".
    2. Next you should not start AI Read VI until you press the Write to File. I am attaching an example VI below. Please see if it helps.
    Regards,
    Sastry V
    applications Engineer
    National Instruments
    Attachments:
    MostRecentAcquiredData.vi ‏97 KB

  • I have written a binary file with a specific header format in LABVIEW 8.6 and tried to Read the same Data File, Using LABVIEW 7.1.Here i Found some difficulty.Is there any way to Read the Data File(of LABVIEW 8.6), Using LABVIEW 7.1?

    I have written a binary file with a specific header format in LABVIEW 8.6 and tried  to Read the same Data File, Using LABVIEW 7.1.Here i Found some difficulty.Is there any way to Read the Data File(of LABVIEW 8.6), Using LABVIEW 7.1?

    I can think of two possible stumbling blocks:
    What are your 8.6 options for "byte order" and "prepend array or string size"?
    Overall, many file IO functions have changed with LabVIEW 8.0, so there might not be an exact 1:1 code conversion. You might need to make some modifications. For example, in 7.1, you should use "write file", the "binary file VIs" are special purpose (I16 or SGL). What is your data type?
    LabVIEW Champion . Do more with less code and in less time .

  • How to write non-XML data to a file using an OSB FTP Routing?

    Hi --
    Situation ... I need to write non-XML data to a file using FTP. A proxy service retrieves XML and transforms it with XSLT to CSV format, then gives it to a Biz service to file it out, using FTP. Simple.
    Problem ... OSB sends the contents of $body to any service it calls. Because $body is a SOAP document, it has to contain XML. So therefore I have to put my CSV data into an XML element, in order to put it into $body; and this inner element then gets written to the file, which I don’t want. But if I don't enclose my CSV content in a tag, I get "Unexpected CDATA encountered" trying to assign it to a variable.
    There has to be away around this!
    Thanks for your help.
    John Taylor

    Solved. Steps:
    -- Transform the XML to CSV using an XSL transform. Put the CSV data inside enclosing XML elements, and use a Replace action to put the XML element + CSV contents back into *$body*.
    -- Define an MFL transform that only knows about the enclosing XML elements. Use a delimiter of "\n" (hard return).
    -- Route from the proxy service to a Biz service that has Service Type = Messaging Service and Request Message Type = MFL; specify the MFL transform, which will receive the incoming *$body* variable, strip off the enclosing XML element within it, and pass the CSV contents to the FTP service.
    Edited by: DunedainRanger on Nov 29, 2011 9:03 AM

  • Trying to write an Automator program to find files with same time created and change file names to matching source folder names

    I am failrly green when it comes to automator.
    I am trying to write an Automator program:
    Not sure where to post this
    trying to write an Automator program to find files and alter their names
    I have a source folder with correct named master files in it.
    eg. A0001_1234.mpeg
    time created 14:02:03
    date 07/07/2012
    Another folder where there will be copies of the master files in a different format with different names but created at the same time as a file in the source directory.
    they are created with a seperate device but they are
    A0000001.mp4
    time created 14:02:03
    date 07/07/2012
    I need it to then take the name from the source fies and apply the correct name to the matching file based on the time it was created.
    I can't seem to find actions in automator that reference time crated.
    Is this something I will be able to Do in automator?
    Any help would be great
    Thanks
    R

    Hi,
    It's impossible to do this without any script in Automator.
    Use this AppleScript script :
    set source to choose folder with prompt "Select the source folder"
    set anotherfolder to choose folder with prompt "Choose the another folder"
    tell application "Finder"
        repeat with tfile in (get files of source)
            set cDate to creation date of tfile
            set findFiles to (files of anotherfolder whose creation date is cDate)
            if findFiles is not {} then
                set tName to name of tfile
                set name of item 1 of findFiles to tName
            end if
        end repeat
    end tell

  • Help!! Trying to writing an array to a file without having to rewrite the old data every time.

    Hey Everyone,
    I have a vi that takes a 2D array and writes it to an xml file. The purpose for this is to characterize the pathloss through a dowkey 10x10 matrix at varies frequencies. I use this program to create a look-up table for the switch matrix so when I conduct one of my automated tests I can obtain an accurate measurment. The problem with this is I am taking about 299 data points per switch matrix combination leading me to over 32000 data points in the look-up table. The reason I use xml is because each data point needs a header so I can parse through the look-up table with another one of my vi's when I need that pathloss. What I am trying to fix is that when my vi writes to a file it writes one array at a time to save memory space. When it writes it rewrites the old data then the new data. As the number of data points increase so does the lag time to write to the file. By the time I am done it takes about five hours to fully write to the file. Does anyone know of a way to write continuesly write to a file without having to rewrite all of the old data? Attached is my vi for writing to the file, my vi for searching through the file, and an example of one of my look-up tables.
    Thanks,
    Dustin
    Solved!
    Go to Solution.
    Attachments:
    Find Array_TestStand.vi ‏22 KB
    Write to XML.vi ‏21 KB
    Pathloss_Array_tests.zip ‏149 KB

    dlovell wroteoes anyone know of a way to write continuesly write to a file without having to rewrite all of the old data?
    The only way to do that is to only append to the end of your file.  This would probably require some rewriting of your header information.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Read and write excel sheet data from uploded file in sharepoint site programmatically 2013

    hi team,
    I am working on sharepoint 2013.I want to read and write data in excel sheet (micrsoft excel) from stored file in shrepoint docoumnt library .please suggest me
    vijay

    Hi
    Vijay,
    check those links
    http://www.sharepointwithattitude.com/archives/61
    https://social.technet.microsoft.com/Forums/en-US/e760051b-a92f-473c-9ec9-0f0c36c99e40/read-and-write-excel-sheet-data-from-uploded-file-in-sharepoint-site-programmatically-2013?forum=sharepointdevelopment
    Kind Regards, John Naguib Technical Consultant/Architect MCITP, MCPD, MCTS, MCT, TOGAF 9 Foundation. Please remember to mark the reply as answer if it helps.

Maybe you are looking for