Read/Write 2d numeric array or string array into bin file

Can anyone pls help me to resolve this problem
Attachments:
bin file.vi ‏9 KB

You are still using the wrong format.
Whatever you are doing has nothing to do with a binary file.
You are still using way too much duplicate code.
All you probably need is read/write from spreadsheet file, no need to reinvent the wheel.
Your code will fail if the numbers contain decimal digits (since your array is DBL, it could! If your array only contains integers, you are using the wrong numeric representation).
You string code will fail if the array elements contains tabs, for example.
You still don't need a sequence structure.
LabVIEW Champion . Do more with less code and in less time .

Similar Messages

  • Cast Object Array to String Array.

    When I try to cast an object array to string array an exception is thrown. How do I go about doing it?
    Vector temp = new Vector();
    Object[] array = temp.toArray();
    String[] nonterms;                              
    nonterms = (String[])array;
    Thanks,
    Ally

    Try this
    import java.util.Vector;
    public class Test
         public static void main(String args[]) throws Exception
              Vector v = new Vector();
              v.add("a");
              v.add("b");
              v.add("c");
              Object[] terms = v.toArray();
              for(int i = 0; i < terms.length; i++)
                   System.out.println((String)terms);
    Raghu

  • Array of String Arrays

    How do I make an array of String Arrays, not knowing how big the array will be
    or how big any of the arrays it contains will be at the time I create it?

    The size of an array is not dynamic, i.e. if you use an array, you must know its size at the time you create it.
    Use one of the collection classes (like java.util.Vector or one of the implementation classes of java.util.List).
    regards
    Jesper

  • How to convert an int array to string array?

    Hi,
    Can anyone please help me with this question?
    int number={4,6,45,3,2,77};
    I like to convert this into a list and sort
    List mylist = Arrays.asList(number);
    Collections.sort(mylist);
    But first I need to convert the int array to String array.
    Please advise. Thanks.

    If you want to convert your int array to a String array, you have no choice but doing a conversion element by element in a for loop.
    However, if the sort method doesn't behave as desired, you can use the one with 2 parameters, the second parameter being a comparator class.
    Check the javadoc for more information : http://java.sun.com/j2se/1.3/docs/api/java/util/Collections.html
    /Stephane

  • How do I write the contents of a string array to file?  Is there a package

    freely avaliable to do this? I am writing a console program that will save the selections made to file. I have convenience packages that came with my book, it allows int and double arrays to be written to file, but not string arrays. Any help would be greatly appreciated.
    Thanks,
    Joe Lavender

    One easy way to do this is to populate a Properties object with the index as the key and the element as the value.
    The properties has built in methods for writing it to file and reading it in.

  • I am reading from an instrument a 1D string array of numbers in ascii. I want to be extract the actual data values from the string. How do I do that?

    labview 6i. Using sr785 instrument.

    Two ways. Use Fract/Exp to Number function on the Strin>Strin Number Conversion palette. It accepts both individual or strin array inputs. Wire your string array in an get an array of doubles out. You can also use Scan From String on the String palette inside of a for loop. The for loop will autoindex the string array in and autoindex an array of doubles out.
    Attachments:
    string_to_double.jpg ‏10 KB

  • Reading an Array of Objects from a .bin file!

    Hey, at the moment I'm creating a program whereby I write a set of objects onto a bin file, in this case an array of objects with a String name/county, and int population/area.... I'm not trying to read it back from the bin file and encountering trouble! I've managed to get it working using plain objects, however I want to be able to read in arrays of objects. The file itself compiles, however during running I get this error
    java.lang.NullPointerException
    at RecordFiles.CoastalRead.main(CoastalRead.java:33)
    at RecordFiles.__SHELL16.run(__SHELL16.java:6)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at bluej.runtime.ExecServer$3.run(ExecServer.java:774)
    Here is the program itself,
    import java.io.*;
    public class CoastalRead {
        public static void main(String[] args) {
            CoastalTowns towns[] = new CoastalTowns[50];
              towns[0] = new CoastalTowns();
              towns[1] = new CoastalTowns();
              towns[2] = new CoastalTowns();
              towns[3] = new CoastalTowns();
              towns[4] = new CoastalTowns();
              String name, county;
              int population, area;
            try {
                FileInputStream fileIn =
                        new FileInputStream("CoastalTownsBin.bin");
                ObjectInputStream in = new ObjectInputStream(fileIn);
                for (int i = 0; i < towns.length; i++){
                 towns[i] =(CoastalTowns) in.readObject();
                   System.out.println("Deserialized File...");
                       System.out.println("Name: " + towns.name);
              System.out.println("County: " + towns[i].county);
         System.out.println("Population: " + towns[i].population);
              System.out.println("Area: " + towns[i].area);
    in.close();
    fileIn.close();
    } catch (IOException i) {}
    catch (ClassNotFoundException c) {}
    +I'd appreciate a fast reply!+ And if someone needs the writing class I've used, I can post it asap.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    CoastalTowns towns[] = new CoastalTowns[50];
    towns[0] = new CoastalTowns();
    towns[1] = new CoastalTowns();
    towns[2] = new CoastalTowns();
    towns[3] = new CoastalTowns();
    towns[4] = new CoastalTowns();Why create an array with a size of 50 and then only fill 5 elements?
    Why bother filling any elements at all when you are reading the objects from a file?
    What happens if there are less than 50 objects in your file?
    I will assume CoastalTowns holds info about a single town, so why is it pluralised? Do you have a class called Dog or Dogs, Chair or Chairs, Person or People?
    } catch (IOException i) {}
    catch (ClassNotFoundException c) {}DO NOT swallow exceptions. At the very least put in a call to printStackTrace so you know if/when an exception occurs.
    I'd appreciate a fast reply!I typed as fast as I could but unfortunately I'm still and hunt and peck guy.

  • Can you parse an array of string characters into separate arrays?

    Hello,
    I didn't see anything directly related to my question, so I'll go ahead and post it.  I'm looking to parse an array of hex characters into three separate arrays for parallel Color to RGB conversion in LabView.  Ideally, after importing an image, I would have liked to use the Color to RGB conversion for the 24-bit pixmap (in hex digit format), but apparently, you can only do this for single number conversions...not arrays.  Another way is what I have mentioned above, which would be to parse each element's red, green, and blue # into three separate arrays as shown below:
    Original Array:   aa11ff     225599
                              cc4488   bbcc11
    Array 1: aa  22
                 cc   bb
    Array 2: 11   55
                  44   cc
    Array 3:  ff    99
                  88   11
    I could then do a parallel conversion of these arrays from hex to numeric and get the desired result.  However, I'm having trouble finding a function that will do this.  So I would like to ask if a function like this does exist and if so, what is it?  I should note that I'm trying to avoid using two while loops because of time constraints (using the program for in-situ measurements), and we do not own, nor are we looking to purchase the $$$ vision/video package that NI makes.

    Nevermind.  I found an adequate way.

  • Simple question: Can you input an array of strings directly into your plot legend instead of "Plot 0", "Plot 1"......?

    I have an array of channel names for a simple vi I wrote and I want to input them into the plot legend.  I typically use ring controls to allow different users to select what they want to see, but beyond 3 or 4 it gets confusing.  Is there a way to take an array of strings and input them directly into the legend string slots using a property node?  I have spent hours searching to no avail.
    Thanks!!
    Adam

    Yes, of course there is! Try this:
    Message Edited by altenbach on 05-01-2009 08:45 PM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    PlotNamesII.png ‏7 KB

  • Readding and writing with currect enties of xml into config file?

    Hey dear Developers,
    i ask about xml file for config.xml.
    If you change line of config.xml than application air will to read sometimes xml structures...
    Example:
    <config>
    <app>
      <lang>langde</lang>
      <style>default</style>
    </app>
    </config>
    If i change to this:
    <config>
    <app>
      <lang>langen</lang>
      <style>default</style>
    </app>
    </config>
    Than Application Air will to load currect ..
    If you change with failure or problem...
    <config>
    <app>
      <lang>langen
      <style>default</style>
    </app>
    </config>
    What does it happen while you changed this failured enties of config.xml. When Application Air will to load error message or create again new xml file?
    I have been tried i have problem of my writeconfig():void ...
    Thanks can you help me ?

    Its likely that there is an ADF deployment listener that is adding the skeleton faces-config.xml to the web application because it did not find one in the project in the standard location. OJDeploy simply invokes the JDeveloper deployment in headless mode to an archive that is the same as what you would see when deploying to an archive from within the IDE. You can verify this by deploying the same module from within the JDEV IDE.
    You can either move your validator to the JDev standard location WEB-INF/faces-config.xml or use Ant to do your build entirely. (if you don't need JDev specific deployment behavior). If this does not work for you, you could open a bug to see if it is possible to stop JDev from generating the skeleton file.

  • How do I write an array of strings to a single Excel row?

    I'd like to write test data, as an array of strings, to an Excel file. Attached is my attempt to modify one of the Labview 6.1 example files. This modified example will write the data to the correct row, which is determined by serial # of the UUT, but to a new sheet for each unit. I'd like to do the same thing, but to just one sheet. This sheet's data would then be saved after 50 rows of collected test data.
    Thank you in advance,
    Tim Denson
    Attachments:
    Write Table To XL.vi ‏58 KB

    Sorry I didn't get back to faster on this. I've been out of town working and just really haven't had time.
    Yes,
    The Report Generation toolkit would make this very easy. If you have it, I'd suggest using it.
    The image shown below shows the five VIs from the toolkit that I've used to write to Excel.
    What this loop does is receive a string through a Queue, either open a
    template or open todays file, convert the tab delimited string to an
    array, write the array to the next line of the Excel file, Save (with
    todays date stamp if opened from the tempate) and close it. It's a good
    idea to always save and close teh file after each write if it's not
    being continuously written to. In this case, a new line will be written
    only once a minute or so. This lessens the chance of losing data if the
    machine locks up for some reason. Opening and closing does take time
    and can slow down a loop that needs to run at a certain rate. This loop
    actually runs in a background process and several other processes send
    data to it through the queue to be written. The queue can buffer
    several data streams if needed so you won't lose data if it's busy and
    you don't have to worry about two processes accessing the Excel sheet
    at the same time.
    Ed
    Message Edited by Ed Dickens on 02-18-2006 11:12 AM
    Ed Dickens - Certified LabVIEW Architect - DISTek Integration, Inc. - NI Certified Alliance Partner
    Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
    Attachments:
    RGTK Array to Excel.gif ‏14 KB

  • Please Help - How do you access/read an element in array of strings

    Hi,
    I want to load up some VI's into subpanels and I have created a for next loop.  Outside the loop is my files and a build array function.  How do you read the first element of the string array?
    I have been programming in Agilent VEE Pro for several years and I am only just learning LabVIEW.  It seems very different!  In VEE, you could use a formula to pass the first element of an array. eg. Array[Element No]
    TIA

    Hi,
    Well, I did try this but I get this error message:
    You have connected a scalar (non-array) data type to an array of the same data type. This type conflict may be resolved by building the scalar type into an array. Check for a tunnel on a loop that has indexing incorrectly disabled.
    The type of the source is string.
    The type of the sink is 1-D array of
    double [64-bit real (~15 digit precision)].
    Attachments:
    MyCode.vi ‏8 KB

  • Print string array

    Hi
    for printing numbers, I would do this:
    for (int x=0; x<=myArray; x++)
    System.out.prin(x);
    But How would I do for printing String values I have read in to a string array?
    I have read in som names to a string array and can print them by:
    System.out.print(myarray[0] + myArray[2]);
    This would print index 0 and 2 in the array. But this is not so good if you have an index large as 100 for example. So how would i go thru the String array and print out the variables?
    Martin

    dream77 wrote:
    case 2: // Print out the list
                        for (int x=0;x<arrNames.length; x++)
                             if (x < nameCount)
                             System.out.print(arrNames[x]);
    1) ALWAYS enclose for loop and if statements in curly braces, even if it's only one statement. So don't do either of these:
    if (fubar ==3)
        doThis();
    // and
    for (int snafu = 0; snafu < myLength; snafu++)
        doThat();instead write:
    if (fubar ==3)
        doThis();
    // and
    for (int snafu = 0; snafu < myLength; snafu++)
        doThat();
    }You'll thank me for this later.
    2) If nameCount is less than arrNames.length always, why use this as the exit condition in your for loop? i.e.,
    for (int x = 0; x < nameCount; x++)
        System.out.print(arrNames[x]);
    }

  • Read/write permissions error message

    Hello everybody,
    I have recently upgraded to Logic Studio from LE8. Now, I am into manual reading and all that stuff, but there are a couple of issues that confuse me at the moment.
    1) I am not able to edit an audio file that I created by recording an external instrument using Logic. When I try to use Factory functions in Sample Editor these appear to be faded.
    2) The following message appears when I try to refresh audio file information in Audio Bin:
    "The read/write permission of only one access path to a file can allow writing
    Result code = -49
    File = <filename>"
    PS: I haven't had these issues when using LE8.

    Ok, I fixed both issues by applying the same privileges to the folder (and its contents) where my Logic projects are, including LE projects. Just right-clicked the folder name, selected "Get Info" -> "Sharing & Permissions" -> defined permissions -> selected "Apply to enclosed items" from the drop menu at the bottom of the Info window.

  • Read/write access when opening or saving file

    We keep getting the message "specified file not found,
    followed by the dreaded "read/write access denied" message when we
    try to open files (whether Freehand or Illustrator files) and
    sometimes when trying to save. We've tried to delete the prefs., as
    noted in other threads, but this hasn't worked for us. We are
    running Freehand MXa on PC's running Windows XP. We are trying to
    mostly open previously created Mac files.
    Can anyone help? Thanks very much!!!!

    I've not seen Word crash when selecting a smart folder - but it doesn't 'see' what's inside either. In other words when I select a smart folder in the file selector it appears to be an empty folder. And this isn't just a Word thing - lots of programs behave this way.
    I use smart folders from the desktop. I have a folder in my Dock which contains all my smart folders. I open a smart folder from there and then double-click the document I want to open. It is a work around obviously but it works

Maybe you are looking for

  • Rate my Rig - PrePurchase Jitters

    Hi all. I'm about to invest a bundle into a new setup for my office (I work in commercial real estate but enjoy dabbling with lots of technologies ranging from programming to video editing) and was hoping to get a bit of advice as to any ways to impr

  • Can´t import artwork in itunes7

    I had not been able to create an itunes account, because I do not live in the countries where the store is currently open. Therefore, when I import music from CDs it does not import automatically artwork (one of the most desired features). What can I

  • Broken DCs because of ess/per

    Our ESS track has the following components checked in: SAP_ESS 603 sps2 EP_BUILDT nw7.0 sp16 SAP-JEE nw7.0 sp16 SAP_BUILDT nw7.0 sp16 SAP_JTECHS nw7.0 sp16 SAPPCUI_GP 600 sp13 In CBS we see our ESS/PER never builds successfully because of an error: d

  • Adobe Photoshop Elements 2 Insta.

    I want to Install 32bts in WINDOWS 7 Adobe Photoshop Elements 2, used with Windows XP thanks in advance

  • Adobe Reader not working because of Executive Data Protection

    I am unable to open any PDF files because of Executive Data Protection on Windows Vista.  How do I get around this?