Frequency response vi and writing to lvm files

I'm having trouble writing the magnitude y/x of the frequency response vi to an .lvm file.
I don't get any samples in my file when I run the program.
Any idea what I'm doing wrong here?
Attachments:
testernw.vi ‏381 KB

Hi,
If you place indicators immediately before and after the frequency response express VI, what do they show?  Are there any differences between the input data before and after the conversions are applied?  I tried putting together a simple VI that takes two simulated signals, inputs them into the frequency response graph, and then outputs it to a file.  It appears to work fine, as long as the two inputs are at a different frequency.
What version of LabVIEW are you using?  Where specifically are you reading the 0 values?
Regards,
Lauren
Applications Engineering
National Instruments

Similar Messages

  • Reading and Writing large Excel file using JExcel API

    hi,
    I am using JExcelAPI for reading and writing excel file. My problem is when I read file with 10000 records and 95 columns (file size about 14MB), I got out of memory error and application is crashed. Can anyone tell me is there any way that I can read large file using JExcelAPI throug streams or in any other way. Jakarta POI is also showing this behaviour.
    Thanks and advance

    Sorry when out of memory error is occurred no stack trace is printed as application is crashed. But I will quote some lines taken from JProfiler where this problem is occurred:
              reader = new FileInputStream(new File(filePath));
              workbook = Workbook.getWorkbook(reader);
              *sheeet = workbook.getSheet(0);* // here out of memory error is occured
               JProfiler tree:
    jxl.Workbook.getWorkBook
          jxl.read.biff.File 
                 jxl.read.biff.CompoundFile.getStream
                       jxl.read.biff.CompoundFile.getBigBlockStream Thanks

  • Very slow painting while reading and writing doubles into file

    for 15MB length file i = 7662080
    for 50MB length file i = 12414368
    Part of Code for writing into file follows like this:
    try{
    fos = new FileOutputStream("Angel.txt");
    File f = new File("Angel.txt");
         if(f.length() >=4)
         f.delete();
    fos = new FileOutputStream("Angel.txt");     
    dos = new DataOutputStream(new BufferedOutputStream(fos,1000000));
    int x=0;
    double y_last, y_new;
    for(int j=0 ;j<i ;j++)
    if(some condition)
    y_new = ....;
    try{
    //previously in vectors
    y_last = y_new;
    vect.add(new Line2D.Double(x, y_last, x, y_new)_;
    dos.writeDouble(y_new);
         }catch(Exception e){System.out.println(e);}
    dos.close();
    fos.close();
    x++;
    }catch(Exception excp){System.out.println(excp);}
    part of code for reading from file follows like this:
    public void paint(Graphics g)
    try{
         double y1, y2 =0;               
         Line2D.Double doub;
         raf = new RandomAccessFile("Angel.txt","r");
         dis = new DataInputStream(new BufferedInputStream(new FileInputStream(raf.getFD(),1000000)));
         raf.seek((rect.x*8));
         for (int i = 0/any value; (i < value as per choice); i++)
              g2.setStroke(new BasicStroke(0)); //2
              y1 = y2;
         y2 =dis.readDouble();
              doub=new Line2D.Double(i,y1,i,y2);
              g2.draw(doub);
    dis.close();
         raf.close();
    }catch(Exception excp){System.out.println(excp);}
    I tried using Object Streams but NotSerializable Exception is thrown as Line2D.Double objects
    are not serialized.
    Any idea to make reading and writing into file specially from MB files faster is appreciated.

    Why are you reading in the file in the paint method ?
    Create your data once before painting.
    I think you should explain what is your goal and what behavior you want.
    Denis

  • Frequency response - sound and vibration

    Hi,
    I need to find the frequency response of the DUT. I am using the NI example from sound and vibration toolkit to do
    so (LabVIEW 8.5\examples\Sound and Vibration\Getting Started\SVXMPL_Getting Started with Swept Sine (DAQmx).vi) now my problem is
    to tabulate the phase difference between the stimulus and response when i do it i get constant values. Even though i dont give any response 
    signal to the channel i get the wave same as stimulus, is it suppose to be like that !!!!!!!!!! I will attach my vi so that it gives the idea where 
    i am measuring the phase difference pls check it and help me with this.....thank you in advance.
    Attachments:
    DAQ Freq resp (req)_trial.vi ‏121 KB

    What is the DAQ card you are using for executing this Frequency Response?
    This DAQ error is related to the output frequency of your signal higher than the possible output rate of the card. Basically, you are trying to update at a rate higher than the capability of the card.
    For doing Frequency response, generally you need to have a NI DSA card (446x/447x/449x) with one Analog output and two analog inputs (minimum). Generate the swept sine signal from the Analog output channel, give this signal as input to your DUT and also to one of the Analog input channel. This input to your Analog input channel will act as your Reference signal. Then the response signal from your DUT, connect it to another Analog input channel. You would get a very good response results.
    The reason why you need to have a DSA board is that, for doing Frequency response, we need to acquire both high frequency and low frequency components without much loss. This is possible only if your DAQ board has a higher dB value (in the range of >110dB) which is present only in DSA boards.
    I have completed a Frequency Response Analysis just a week back with the same example programs. So there wont be any problem with that vi.
    Regards,
    Sundar Ganesh

  • Problem reading and ploting large lvm files

    Hi everyone,
    I have some large .lvm files that I need to process offline; however, the files are quite large and I am regulalry getting "out of memory" messages (7 channels sampled at 4k for 15 minutes or so, maybe longer)... I have managed to reduce the rate this message occurs by first converting the lvm files to tdms, then potting the tdms data, but I still get the "out of memory" error message on somewhat regularly.. .I also down sample the data back to 2k, but that dont help a great deal.
    Any suggestions on how I can handle this data? I have read a number of online resources related to managing large data sets (e.g. http://www.ni.com/white-paper/3625/en/) but I am not sure how to implement these suggestions.
    Basically, I want to view the content of the ensure file... Then use queues to extract data subsets as selected into another while loop that will handle the analysis/processing (producer/consumer)... I do this regularly for smaller files; so the issue is mainly how to managing the large files... Decimating the data for the intial whole data plot may not work as I have spikes 10ms in width in some channels that I need to see in the main plot.
    Any help would be appreciated.
    Many thanks,
    Jack

    jcannon,  I did some quick math and I dont think you should be reaching the memory limit of LabVIEW.  However, it is possible that you are running out of contiguous memory on your computer while the program is running.  See this for a quick breif about contiguous memory.  
    If I were you I would try to reduce the number of times LabVIEW coppies information in memory.  Use show buffer allocations to find out where in your code you are making coppies of memory.  
    best of luck!

  • Help on reading from and writing to a file !!!!!!!!!!!!!!!!

    hi there
    anyone can help me on how to write and read from a file? how can i read one string at a time instead of a char. thank you.

    You can do this with classes FileReader and FileWriter directly, but it's easiest to wrap these with other classes and call methods on those to read and write a string. All of the classes used below are in the java.io package. The code fragments just print any I/O exceptions to stderr. Replace filename with the name of the file you want to use.
    To write a string to a file:
    String s = "hello";
    try {
    FileWriter fw = new FileWriter("filename");
    PrintWriter pr = new PrintWriter(fw);
    pr.println(s); // write a string with a newline at the end
    // pr.print(s); // write a string without a newline at the end
    pr.close(); // must close for string to be written
    } catch (IOException e) {
    System.out.println(e);
    To read a string from a file:
    String s;
    try {
    BufferedReader br = new BufferedReader(new FileReader("filename"));
    s = br.readLine();
    } catch (IOException e) {
    System.out.println(e);

  • Reading and writing from a file

    I am trying to read and write to a file so that I may store an array of string and a double in my application, but I have come upon a couple of problems; first when I put my file path into the path constant it will say that the file is not there ever though it is (so I have to force the issue and when the application asks for a file I have to browse and add the files), secondly when I run the program and it reads from the file it does not display the strings or doubles immediately instead I have to hit the submit button and than they finally come up, thirdly when I reset my values in the .txt files and put in my string and double and hit submit the array jumps one spot and starts at the index of 1 (array[1])  if anyone can help I would appreciate it a lot.
    here is my code:
    Harold Timmis
    [email protected]
    Orlando,Fl
    *Kudos always welcome
    Solved!
    Go to Solution.
    Attachments:
    testingfileIO.vi ‏30 KB
    double.txt ‏1 KB
    string.txt ‏1 KB

    Harold Timmis wrote:
    I am trying to read and write to a file so that I may store an array of string and a double in my application, but I have come upon a couple of problems; first when I put my file path into the path constant it will say that the file is not there ever though it is (so I have to force the issue and when the application asks for a file I have to browse and add the files),
    I don't see that behavior at all about forcing the issue.  Why are you using Not a Path constants?  Why not turn those constants into controls you put on your front panel?
    secondly when I run the program and it reads from the file it does not display the strings or doubles immediately instead I have to hit the submit button and than they finally come up,
    Put your array indicators before your event structure rather than after.  Think dataflow.  The code pauses at the event structure waiting for an even to fire.  Only when it does (such as hitting the submit button) does the data get written to the array indicators. 
    thirdly when I reset my values in the .txt files and put in my string and double and hit submit the array jumps one spot and starts at the index of 1 (array[1])  if anyone can help I would appreciate it a lot.
    I don't see this behavior either.  How come your double.txt file has names in it, and your string.txt file has doubles in it?

  • Help on reading and writing to a file !!!!!!!!!!!!!!!!

    hi there
    anyone can help me on how to write and read from a file? how can i read one string at a time instead of a char. thank you.

    Use the StringTokenizer to break up the line
    File newFile = new File("text.txt");
    BufferedReader in = new BufferedReader(new FileReader (newFile));
    String line;
    while((line = in.readLine()) != null){
    StringTokenizer st = new StringTokenizer(inputLine, " ");
    while(st.hasMoreTokens()){
    // do something with the token
    // e.g:
    // String lc = st.nextToken().toLowerCase()
    hope that helps

  • Building array and writing to multiple files

    Greetings,
    I have a VI wherein, I am collecting data from 3 channels (using Global Virtual Channels with scaling). I am collecting 100 samples at a time with sampling frequency of 1000 Hz. I am then taking average and st. dev of 100 data points/channel and write it to a file (‘*.dat’). I would like to limit the file size to 1000 entries, and so after that limit is reached I would like to create a new file and write the subsequent set of data to the next file and so on. I am doing this in a case structure, wherein I build an array of the values until the condition of file limit is reached and then I write that array to a ‘*.dat’ file. (I’m hoping that this logic is correct, if not please suggest the correct method)
    I am also taking average and st. dev of data/channel over period of 1 sec and write it to another ‘*.sum’ file. The VI has other features like writing time stamp to file, stopping the VI after preset time limit is reached or certain safety limit is reached.
    When I run the VI, I get an error message:
    Error 7 occurred at Open/Create/Replace File in Global Channel with Multiple file Write.vi
    Possible reason(s):
    LabVIEW:  File not found. The file might have been moved or deleted, or the file path might be incorrectly formatted for the operating system. For example, use \ as path separators on Windows, : on Mac OS X, and / on Linux. Verify that the path is correct using the command prompt or file explorer.
    =========================
    NI-488:  Nonexistent GPIB interface.
    I have indicated the location of the error in the attached picture, as well as I’m attaching the VI.
    I would really appreciate if someone would tell me what is causing the error and how to fix it.
    Thanks,
    Dinesh
    Solved!
    Go to Solution.
    Attachments:
    Block Diag.png ‏121 KB
    Global Channel with Multiple file Write.vi ‏515 KB

    I did try that but it does not solve the problem. I think I'm missing something while building the array in the Case Structure. I would like to write the average & st. dev values/channel in an array while the loop coount < file limit, and once the file limit is reached write that array to a *.dat file. And keep repeating this procedure till the target time is reached.
    Another issue that I discovered is that TestFile_1.dat is not generted, after TestFile_0.dat TestFile_2.dat gets generated. I'm not sure why this is happening.
    I would really appreciate if you would take another look and suggest some debugging tips.
    Thanks.
    P.S. I am attaching the updated VI
    Attachments:
    Global Channel with Multiple file Write.vi ‏515 KB

  • READING AND WRITING FROM A FILE(WRITTEN IN ANOTHER LANGUAGE)

    # Comment
    INTEGER Declares integer type variable
    STRING Declares string type variable
    LET Assigns a variable
    CALCULATE Performs an arithmetic calculation
    PRINT Writes data to the console
    PRINTLN As print, but followed by a new line
    END Terminates the program
    Each line of the program must begin with one of these words, and the language should not be case sensitive.
    Tim Brailsford, 2007
    G64ICP
    COMMENT
    Any line beginning with the # character is completely ignored.
    Example:
    # ignore this line!
    INTEGER
    The INTEGER reserved word declares an Integer variable, and assigns a default value of 0 to it.
    Example:
    INTEGER myInt
    This example is equivalent to the Java statment "int myInt=0;"
    STRING
    The STRING reserved word declares a String variable, and assigns an empty string to it.
    Example:
    STRING myString
    This is equivalent to the Java statement "String myString;"
    LET
    This assigns values to variables (either integers, or strings enclosed
    in double quotes).
    Examples:
    LET myInt=42
    LET myString="Hello World!"
    CALCULATE
    This performs numeric calculations upon values or variables, and assigns the result to a variable (which must have
    been declared earlier). Four operators are supported: + *
    and / (for addition, subtraction multiplication and
    integer division respectively).
    Examples:
    CALCULATE myInt=2*2
    CALCULATE myInt=myInt+24
    CALCULATE myInt=intA/intB
    PRINT and PRINTLN
    These words both print to the console the
    only difference being that PRINTLN appends a new line (as does
    System.out.println in Java). These can print either text provided as an argument, or variables (string or integer).
    Examples:
    PRINTLN "Hello World!"
    PRINT myString
    PRINTLN myInt
    END
    This terminates the program, and prints a message to that effect.
    TPL Example
    To the left is an example TPL input file , to
    calculate the factorial of 5. This should produce
    an output similar to that shown overleaf (except
    that calculates the factorial of 10).
    # A TPL Program to calculate the factorial of 5
    INTEGER myInt
    INTEGER factorial
    STRING myString
    LET mystring="Factorial Program"
    LET myInt=5
    CALCULATE factorial=myInt*4
    CALCULATE factorial=factorial*3
    CALCULATE factorial=factorial*2
    Tim Brailsford, 2007
    G64ICP
    PRINTLN mystring
    PRINTLN
    PRINT "The factorial of "
    PRINT myInt
    PRINT " is "
    PRINTLN factorial
    END
    Documentation
    Document your code by writing instructions explaining how to run it, listing all of the files you have submitted,
    and specifying any limitations (eg you might want to say what platforms you would expect it to run on, and what
    platforms you have tested it on). This document should be written as a plain text file (ie ASCII � MS Word binary
    files are not acceptable) � and this file should be called README.TXT. This file should constitute the user
    manual of your program, and should explain exactly how to use your program.
    The README file should be the user manual for your language as implemented.
    NB:
    I want it to read values from the file as given above and execute the answer in the command prompt( as intented in the file above)
    Thanks
    Alam Ikenna

    Hai I have one doubt in doing other peoples homework for them. Why bother?

  • Hoping for a quick response : EXP and Archived REDO log files

    I apologize in advance if this question has been asked and answered 100 times. I admit I didn't search, I don't have time. I'm leaving on vacation tomorrow, and I need to know if I'm correct about something to do with backup / restore.
    we have 10g R2 running a single instance on a single server. The application vendor has "embedded" oracle with their application. The vendor's backup is a batch file using EXP - thus:
    exp system/xpwdxx@db full=y file=D:\Orant\admin\db\EXP\db_full.dmp log=D:\Orant\admin\db\EXP\db_full.txt direct=y compress=y
    This command is executed nightly at midnight. The files are then backed up by our nightly backup to offsite storage media.
    Te database is running in autoarchive mode. The problem is, the archived redo files filled the drive they were being stored on, and it is the drive the database is on. I used OS commands to move 136G of archived redo logs onto other storage media to free the drive.
    My question: Since the EXP runs at midnight, when there is likely NO activity, do I need to run in AutoArchive Mode? From what I have read, you cannot even apply archived redo log files to this type of backup strategy (IMP) Is that true? We are ok losing changes since our last EXP. I have read a lot of stuff about restoring consistent vs. inconsistent, and just need to know: If my disk fails, and I have to start with a clean install of Oracle and nothing else, can I IMP this EXP and get back up and running as of the last EXP? Or do I need the autoarchived redo log files back to July 2009 (136G of them).
    Hoping for a quick response
    Best Regards, and thanks in advance
    Bruce Davis

    Bruce Davis wrote:
    Amardeep Sidhu
    Thank you for your quick reply. I am reading in the other responses that since I am using EXP without consistent=y, I might not even have a backup. The application vendor said that with this dmp file they can restore us to the most recent backup. I don't really care for this strategy as it is untested. I asked them to verify that they could restore us and they said they tested the dmp file and it was OK.
    Thank you for taking the time to reply.
    Best Regards
    BruceThe dump file is probably ok in the sense it is not corrupted and can be used in an imp operation. That doesn't mean the data in it is transactionally consistent. And to use it at all, you have to have a database up and running. If the database is physically corrupted, you'll have to rebuild a new database from scratch before you can even think about using your dmp file.
    Vendors never understand databases. I once had a vendor tell me that Oracle's performance would be intolerable if there were more than 5 concurrent connections. Well, maybe in HIS product ..... Discussions terminated quickly after he made that statement.

  • Need Help: UTL_FILE Reading and Writing to Text File

    Hello I am using version 11gR2 using the UTL_FILE function to read from a text file then write the lines where it begins with word 'foo' and end my writing to the text file where the line with the word 'ZEN' is found. Now, I have several lines that begin with 'foo' and 'ZEN' Which make for one full paragraph, and in this paragraph there's a line that begins with 'DE4.2'. Therefore,
    I need to write all paragraphs that include the line 'DE4.2' in their beginning and ending lines 'foo' and 'ZEN'
    FOR EXAMPLE:
    FOO/234E53LLID
    THIS IS MY SECOND LINE
    THIS IS MY THIRD LINE
    DE4.2 THIS IS MY FOURTH LINE
    THIS IS MY FIFTH LINE
    ZEN/DING3434343
    FOO/234E53LLID
    THIS IS MY SECOND LINE
    THIS IS MY THIRD LINE
    THIS IS MY FIFTH LINE
    ZEN/DING3434343
    I am only interested in writing the first paragraph tha includes line DE4.2 in one of ther lines Not the Second paragraph that does not include the 'DE4.2'
    Here's my code thus far:
    CREATE OR REPLACE PROCEDURE my_app2 IS
    infile utl_file.file_type;
    outfile utl_file.file_type;
    buffer VARCHAR2(30000);
    b_paragraph_started BOOLEAN := FALSE; -- flag to indicate that required paragraph is started
    BEGIN
    -- open a file to read
    infile := utl_file.fopen('TEST_DIR', 'mytst.txt', 'r');
    -- open a file to write
    outfile := utl_file.fopen('TEST_DIR', 'out.txt', 'w');
    -- check file is opened
    IF utl_file.is_open(infile)
    THEN
    -- loop lines in the file
    LOOP
    BEGIN
    utl_file.get_line(infile, buffer);
         --BEGINPOINT APPLICATION
    IF buffer LIKE 'foo%' THEN
              b_paragraph_started := TRUE;          
         END IF;
         --LOOK FOR GRADS APPS
              IF b_paragraph_started AND buffer LIKE '%DE4%' THEN
              utl_file.put_line(outfile,buffer, FALSE);
    END IF;
         --ENDPOINT APPLICATION      
              IF buffer LIKE 'ZEN%' THEN
         b_paragraph_started := FALSE;
              END IF;
    utl_file.fflush(outfile);
    EXCEPTION
    WHEN no_data_found THEN
    EXIT;
    END;
    END LOOP;
    END IF;
    utl_file.fclose(infile);
    utl_file.fclose(outfile);
    EXCEPTION
    WHEN OTHERS THEN
    raise_application_error(-20099, 'Unknown UTL_FILE Error');
    END my_app2;
    When I run this code I only get one line: DE4.2 I AM MISSING THE ENTIRE PARAGRAPH
    PLEASE ADVISE...

    Hi,
    Look at where you're calling utl_file.put_line. The only time you're writing anything is immediately after you find the the key word 'DE4', and then you're writing just that line.
    You need to store the entire paragraph, and when you reach the end of the paragraph, write the whole thing only if you found the key word, like this:
    CREATE OR REPLACE PROCEDURE my_app2 IS
        TYPE  line_collection  
        IS       TABLE OF VARCHAR2 (30000)
               INDEX BY BINARY_INTEGER;
        infile               utl_file.file_type;
        outfile                      utl_file.file_type;
        input_paragraph          line_collection;
        input_paragraph_cnt          PLS_INTEGER     := 0;          -- Number of lines stored in input_paragraph
        b_paragraph_started      BOOLEAN      := FALSE;     -- flag to indicate that required paragraph is started
        found_key_word          BOOLEAN          := FALSE;     -- Does this paragraph contain the magic word?
    BEGIN
        -- open a file to read
        infile := utl_file.fopen('TEST_DIR', 'mytst.txt', 'r');
        -- open a file to write
        outfile := utl_file.fopen('TEST_DIR', 'out.txt', 'w');
        -- check file is opened
        IF utl_file.is_open(infile)
        THEN
         -- loop lines in the file
         LOOP
             BEGIN
              input_paragraph_cnt := input_paragraph_cnt + 1;
                 utl_file.get_line (infile, input_paragraph (input_paragraph_cnt));
              --BEGINPOINT APPLICATION
              IF LOWER (input_paragraph (input_paragraph_cnt)) LIKE 'foo%' THEN
                  b_paragraph_started := TRUE;
              END IF;
              --LOOK FOR GRADS APPS
              IF b_paragraph_started
              THEN
                  IF  input_paragraph (input_paragraph_cnt) LIKE '%DE4%'
                  THEN
                   found_key_word := TRUE;
                  END IF;
                  --ENDPOINT APPLICATION
                  IF input_paragraph (input_paragraph_cnt) LIKE 'ZEN%' THEN
                      b_paragraph_started := FALSE;
                   IF  found_key_word
                   THEN
                       FOR j IN 1 .. input_paragraph_cnt
                       LOOP
                           utl_file.put_line (outfile, input_paragraph (j), FALSE);
                       END LOOP;
                   END IF;
                   found_key_word := FALSE;
                   input_paragraph_cnt := 0;
                  END IF;
              ELSE     -- paragraph is not started
                  input_paragraph_cnt := 0;
              END IF;
              EXCEPTION
                  WHEN no_data_found THEN
                   EXIT;
              END;
          END LOOP;
        END IF;
        utl_file.fclose (infile);
        utl_file.fclose (outfile);
    --EXCEPTION
    --    WHEN OTHERS THEN
    --        raise_application_error(-20099, 'Unknown UTL_FILE Error');
    END my_app2;
    SHOW ERRORSIf you don't have an EXCEPTION section, the default error handling will print an error message, spcifying exactly what the error was, and which line of your code caused the error. By using your own EXCEPTION section, you're hiding all that information. I admit, the error messages aren't always as informative as we'd like, but they're never less informative than "Unknown UTL_FILE Error'. Don't use your own EXCEPTION handling unless you can improve on the default.
    Remember that anything inside quotes is case-sensitive. If your file contains upper-case 'FOO', then it won't be "LIKE 'foo%' ".
    Edited by: Frank Kulash on Dec 7, 2011 1:35 PM
    You may have noticed that this site normally doesn't display multiple spaces in a row.
    Whenever you post formatted text (such as your code) on this site, type these 6 characters:
    \{code}
    (small letters only, inside curly brackets) before and after each section of formatted text, to preserve spacing.

  • Issue with Reading and Writing to a File

    Hello all,
    I'm having trouble when I run the following example;
    import java.io.FileReader;
    import java.io.FileWriter;
    import java.io.BufferedReader;
    import java.io.PrintWriter;
    import java.io.IOException;
    public class ReadWriteTextFile {
        private static void doReadWriteTextFile() {
            try {
                // input/output file names
                String inputFileName  = "README_InputFile.txt";
                String outputFileName = "ReadWriteTextFile.out";
                // Create FileReader Object
                FileReader inputFileReader   = new FileReader(inputFileName);
                FileWriter outputFileReader  = new FileWriter(outputFileName);
                // Create Buffered/PrintWriter Objects
                BufferedReader inputStream   = new BufferedReader(inputFileReader);
                PrintWriter    outputStream  = new PrintWriter(outputFileReader);
                outputStream.println("+---------- Testing output to a file ----------+");
                outputStream.println();
                String inLine = null;
                while ((inLine = inputStream.readLine()) != null) {
                    outputStream.println(inLine);
                outputStream.println();
                outputStream.println("+---------- Testing output to a file ----------+");
                outputStream.close();
                inputStream.close();
            } catch (IOException e) {
                System.out.println("IOException:");
                e.printStackTrace();
        public static void main(String[] args) {
            doReadWriteTextFile();
    }Im getting the error
    java.io.FileNotFoundException: README_InputFile.txt (The system cannot find the file specified)However the file README_InputFile.txt is definately in the same folder as the class file. So why is this not working?
    Any help would be greatly appreciated.
    Jaz

    Sorry you've lost me. All I get are error messages
    when I try to compile that statement. What am I
    missing?I don't know, it should work:
    import java.io.*;
    public class Test {
    public static void main(String[] args) throws
    IOException {
    System.out.println(new
    File(".").getCanonicalPath());
    Sorry I forgot to add the "throws IOException" bit. It works and told me that the path is;
    C:\Documents and Settings\Jaz\workspace\Tutorial
    I've amended the code so it now looks like this;
    String inputFileName  = "C:/Documents and Settings/Jaz/workspace/TutorialREADME_InputFile.out";
                String outputFileName = "C:/Documents and Settings/Jaz/workspace/TutorialReadWriteTextFile.out";but I still get the error below even though the files are present in that directory;
    IOException:
    java.io.FileNotFoundException: C:\Documents and Settings\Jaz\workspace\TutorialREADME_InputFile.out (The system cannot find the file specified)

  • Recording data at particular iterations and writing to text file

    Hi all,
    this is my first time posting on the NI boards. I'm running into a couple problems I can't seem to figure out how to fix.
    I'm collecting data using a LabJack U3-HV daq. I've taken one of the out-of-the-box streaming functions that comes with the LabJack and modified it for my purposes. I am attempting to simply save the recorded data to a text file in columns, one for each of my 4 analog strain gauge inputs, and one for time. For some reason when the 'write to measurement file.vi' executes it is puts everything in rows, and the data is unintelligible.
    The 2nd issue I am facing, which is not currently visible in my vi, is that I am running my test for 60,000 cycles, which generates a ton of data. I'm measuring creep/fatigue with my strain gages so I don't need data for every cycle, probably for the first 1000, then the 2k, 4k, 6k, 8k, 10k, 20k, etc. More of an exponential curve. I tried using some max/min functions and then matching the 'write to measurement file.vi' with a case structure that only permitted it to write for particular iterations, but can't seem to get it to work.
    Thanks in advance for any help!
    Attachments:
    3.5LCP strain gages v2.vi ‏66 KB

    Hey carfreak,
    I've attached a screenshot that shows three different ways of trying to keep track of incrementing data and/or time in a while loop. The top loop just shows a program that demonstrates how shift registers can be used to transfer data between loops. This code just writes the iteration value to the array using the Build Array function.
    The first loop counts iterations in an extremely round-about way... the second shows that really you can just build the array directly using the iteration count (the blue "i" in the while loop is just an iteration counter).
    The final loop shows how you can use a time stamp to actually keep track of the relative time when a loop executes.
    Please note that these three should not actually be implemented together in one VI. I just built them in one BD for simplicity's sake for the screenshot. As described above, the producer-consumer architecture should be used when running parallel loops.
    Does that answer your question?
    Chris G
    Applications Engineer
    National Instruments
    Attachments:
    While Loops and Iterations.JPG ‏83 KB

  • Reading and writing u16 binary file to a new file

    Hello all,
    a very simple thing that I just don't seem to be able to figure out. I have a file containing 1024bytes of unsigned 16bit words. I can read it successfully with the right value  being displayed. But then I try to write these values to a new file, I can no longer read the same value (in fact it's all grayed out 0) from the newly written file. The newly written file has the right size 1024 bytes, but I don't seem to obtain the right information. I made sure the endian are the same, little-endian.
     Attached is my basic VI, and the .dat file is the file containing the binary information. 
    I'm not using copy file because once I get this figure out, I'll need to append more of the Scan.dat file to one single file. 
    Thank you!
    Solved!
    Go to Solution.
    Attachments:
    read_write_binary_u16.zip ‏11 KB

    I would put some wait time between the write and the read.  It may be a good idea to actually close the file in between.
    I have a feeling that you may not have allowed enough time to actually have the file written out before you read it again.  That or since it is still open, the file pointer is at the end of the file and you are trying to read all the bytes starting at the end, which means you get nothing.
    Not sure of the exact issue, but those two things comes to mind.

Maybe you are looking for

  • IMac won't shutdown when external hard drive is hooked up.

    Hello, I have a 2011 iMac which i've loved using. I bought a Seagate goflex external harddrive so I could start using time machine. I've noticed that whenver I power my iMac down it will sit on the grey screen just before shutting off for a long time

  • Message Queue Blocking / MSGMNI Setting

    Hi All, Firstly, many thanks to all that can assists. I am currently getting Message Queue Blocking messages in my ULOG files in my Tuxedo Application. (Tux ver 7.1 in Unix). I am not sure what is causing this, but started to look into the Tux Config

  • Substitution block for payment

    Hi, How to set block for payment indicator for unplanned delivery cost invoice created from MIRO. Transaction procedure : - MIRO - Transaction type = subsequent debit invoice - Go to tab details - Enter the unplanned delivery cost If this document sa

  • Error -ORA-01483: invalid length for DATE or NUMBER bind variable

    In discoverer plus, attempt to save a discoverer workbook into the database fails with the error: ORA-01483 invalid length for DATE or NUMBER bind variable The same workbook can be safely saved in "My Computer". Any idea why and what is the solution.

  • Install & synchronization problems

    I purchased a Pearl II with 4.3 software and have tried the installation, but have several problems.  I had a Curve previously and the 4.2 software worked fine. On installation I received 3 Error 1904 messages, ( theSyncAE_pb.dll, DesktopSetup_pb.dll