Issues with spreadsheet string to array

Hi, I have a spreadsheet string (tab delimited) and I am trying to convert it into an array of double with 6 digits of precision after the decimal point. However, as shown in the attached example, the function "spreadsheet to array" is not giving me the desired digit of precision (only 2 after decimal point). I have tried almost everything and I am frustrated with this function. CAN SOMEONE PLZ HELP ME ??
Attachments:
Block diagram.png ‏13 KB
String to array double.vi ‏10 KB
Panel.png ‏28 KB

I have no LV 8.x installed, so I can't check your Code. But it might be your settings for the indicator. In LV 7.1 it defaults to 6 significant digits, that means the reading is 12345,6789 but (only) your indicator displays 12345,6.
Right click on your indicator (Front Panel) and go to formatting.
Felix
www.aescusoft.de
My latest community nugget on producer/consumer design
My current blog: A journey through uml

Similar Messages

  • Apparent inconsistency of "spreadsheet string to array"

    System: LabView6.1, XPpro, 512MB, 2.4GHz
    I have a sub-vi which I call to read a single column of data from a large CSV file. Files can be >500000 rows with 4-8 cols (ie. 15-30MB). The sub-vi uses "Read File", with byte stream type unwired, to return a string. This string is then passed to "spreadsheet string to array" (SStA), to obtain a 2D array. "Index Array" is then used to obtain the required data column.
    If I wire the format string of SStA with %f, and the array type with a 2D double, the sub-VI takes about 8 seconds every time I call it.
    If I wire format string with %s, and array type with 2D string (and convert to a double later, after index array), the sub-VI takes over 50s the first time it is c
    alled, but only about 1s on each subsequent call.
    The bottle neck is ONLY at SStA. I am not explicitly preallocating any arrays.
    Can anyone explain what LabView is doing internally with respects to memory allocation? Why is the second routine slow on the first call only, and subsequently considerably faster than the first routine? Is there any alternative way of "priming" the second sub-vi so it is not slow on the first call? I guess reading only subsets of data at a time might help, but I'd still like to understand what is going on with the current approach.

    Roo Payne wrote:
    > Can anyone explain what LabView is doing internally with respects to
    > memory allocation? Why is the second routine slow on the first call
    > only, and subsequently considerably faster than the first routine? Is
    > there any alternative way of "priming" the second sub-vi so it is not
    > slow on the first call? I guess reading only subsets of data at a time
    > might help, but I'd still like to understand what is going on with the
    > current approach.
    Basically NI seems to have added some performance optimization with
    internal caching to the Spreadsheet String to Array function in the case
    of String outputs. Without it it would always take 50 seconds. If the
    input string does change significantly it probably won't be such a huge
    speed up anymore.
    For numeric type outputs no caching has been added and wouldn't help
    that much in comparison.
    Rolf Kalbermatter
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Delimiter for the Spreadsheet string to array

    Hello,
       I would like to use the Spreadsheet string to array function to process the data obtained from reading a text file that has 2 columns separated by at least one space character. Can the spreadsheet string to array have delimiters other than a comma or tab? 
    Regards,
    Kaspar

    Here's an example of what I had in mind (LabVIEW 8.0). (The delimiter constants are displayed in "'\'-codes").
    As you can see, it ignores consecutive delimiters (even empty lines )
    Message Edited by altenbach on 06-29-2006 09:10 AM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    DirtySpreadsheetStringToArray.png ‏17 KB
    DirtySpreadsheetStringToArray.vi ‏14 KB

  • Unexpected behavior of spreadsheet string to array function

    Hello,
    I found some weirdness in LabVIEW 2011 that I do not understand. In the attached vi, I provide a one-dimensional spreadsheet string separated by spaces. I use the spreadsheet string to array function to convert this spreadsheet string into an array of strings.
    I ran into problems when I wanted to specify a space character as the delimiter.
    The conversion works as intended, if I do not specify a delimiter (i.e., the default tab delimiter is used). But if I specify the delimiter, only the first element of the spreadsheet string is converted. I do not understand this behavior.
    Thanks for your help.
    Peter
    Solved!
    Go to Solution.
    Attachments:
    Test spreadsheet string to array.vi ‏9 KB

    You don't have spaces in your string. You have tabs and of course the default delimiter works. Right click and select '\' Codes Display and see the \t.

  • Fast spreadsheet string to array

    Is there any faster (more effiecient) method of converting a spreadsheet string (simple tabbed single precision floating points) to an array than using "Spreadsheet String to Array"? This seems to be the bottleneck in a program I'm working on. Thanks!
    2006 Ultimate LabVIEW G-eek.

    Not really, how large is the string you are trying to convert? The only real alternative is to convert the string in smaller bits, or perhaps collect the data in an array in the first place.
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • Sling mapping issue with Query String

    For a button component, URL behaves differently with query string. Please let me know the sling mapping example for query string.
    Button component behavior across env:-
    Working Scenario:-
    - In Author edit mode, URL pointing to "/content/<websitelink>"
    - In Author preview mode shows URL "<host>:<port>/content/<websitelink>.html"
    - In Publisher mode shows URL, "<host>:<port>/<websitelink>", we do not want "/content" before website link so it is fine.
    Failure Scenario with query string:-
    - In Author edit mode URL pointing to "/content/<websitelink>?username=han"
    - In Author preview mode with URL "<host>:<port>/content/<websitelink>?username=han"
    - In Publisher mode, <host>:<port>/content/<websitelink>?username=han - Here we see the content, which is not acceptable in our scenario.
    Please let me know the mapping changes when we have a URL with query string.

    1) I assume you configure as per the rules mentioned in http://sling.apache.org/site/mappings-for-resource-resolution.html --> 'Mapping Entry Specification' under /etc/map. Based on the configuration in /etc/map and the website that we publish, it translates and shows all the applicable combination in the Felix console http://<host>:<port>/system/console/jcrresolver.
    2) How does Adobe CQ 5.4 resolve the right mapping, if we have multiple map folder like below in /etc directory with the same website with different rules.
    etc/map --> http --> <website> with property sling:match, sling:internalRedirect
    etc/map.publish --> http --> <website> with property sling:match, sling:internalRedirect
    etc/map.publish-stag --> http --> <website> with property sling:match, sling:internalRedirect
    Kindly clarify.

  • Can more than one delimiter be use at the same time for spreadsheet string to array

    I have a text header in my data file that is space delimited and the data in the file is tab delimited? Any suggestion?

    Sorry, I misread your problem...
    Is the header always of a fixed length in terms of the number of lines? Or can you easily find out from the file how long the header is? If so, you could first read just the header and, instead of using spreadsheet to array function, you could parse the header yourself by using the match string function in a While loop with the search value:
    [\s\t]+
    Assuming slash codes are enabled, this string will match any string of one or more spaces or tabs.
    You could then read the rest of the file and format it using spreadsheet to array with the tab delimiter (that is constant, correct?).
    If you need help with that parsing loop let me know and I'll write one for you...
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • Issue with splitting string into multiple lines

    Hi Experts,
    I have a long string s. I want to split this string into several lines each having 72 characters. For this I have done following programming:
         String s = "For the first time it includes a supplementary report attempting to determine if extreme weather
    events can be linked to human-induced climate change. The research team, including members
    of the UK Met Office, identified recent episodes of extreme weather then used a computer to
    estimate the likelihood of the episode happening in a world without increased CO2." ;
         s = s.replaceAll("[\r\n]+", " ");
         char[] sAr = s.toCharArray();
         AbstractList RecepitsList7 = new Bapitrtext.Bapitrtext_List();;
         int start = 0; // start with
         int i = 72 ;
    //     for (int i = 71; i < sAr.length; i++) {
    while (i < sAr.length) {
    //     {     if (sAr[i] == ' ')
                   Bapitrtext Recepits7 = new Bapitrtext();
                   Recepits7.setTextid("TEXT");
                   Recepits7.setTextline(s.substring(start, i).replaceAll("[\r\n]+", ""));
                   RecepitsList7.add(Recepits7);
                   start = i+1;
                   i += 72;
         input.setText(RecepitsList7);
    The output of program is as below:
    For the first time it includes a supplementary report attempting to dete
    mine if extreme weather events can be linked to human-induced climate
    hange. The research team, including members of the UK Met Office, iden
    ified recent episodes of extreme weather then used a computer to estim
    te the likelihood of the episode happening in a world without increased
    Here as we can see last characters are getting deleted by program. For example in first line
    determine 'r' is missing in extreme right.
    In 3rd line c is missing in extreme left (word change is needed. Program
    prints hange.
    Also in 3rd line extreme right 't' is missing
    Also in 4th line extreme right 'a' is missing
    Also the last line is not being printed. In last line "CO2." " should appear.
    There are two issues:
    1. Why last word of each sentence is not being printed?
    2. Why last sentence is not being printed?
    I am struggling since last 2 days. Please help. I made all changes like replacing 72 by 71 etc.
    By making such changes, I am able to print first line correctly. However under all cases
    last character of 2nd line onward is not getting displayed.
    Also last line is not getting displayed. I did every thing like using while instead of for loop etc.
    Kindly help.
    Regards,
    Gary
    Edited by: 945655 on Jul 10, 2012 11:39 PM

    String s = wdContext.currentContextElement().getExpense_Text();
         s = s.replaceAll("[\r\n]+", " ");
         char[] sAr = s.toCharArray();
         AbstractList RecepitsList7 = new Bapitrtext.Bapitrtext_List();;
         int start = 0; // start with
         int i = 72;
    while (i < sAr.length) {
                   Bapitrtext Recepits7 = new Bapitrtext();
                   Recepits7.setTextid("TEXT");
                   System.out.println(s.substring(start, i));
                   RecepitsList7.add(Recepits7);
                   start = i+1;
                   i += 72;
         input.setText(RecepitsList7);
    Edited by: 945655 on Jul 11, 2012 2:25 AM

  • TimesTen issue with connection string on a 64-bit system

    Hello dear members,
    I need to write code in vbscript that is creating a connection to oracle timesten database.
    The TimesTen database is located on a unix server, and the client application is on windows server.
    this is my code:
    Set mCnTT = CreateObject("ADODB.connection")
    mCnTT.ConnectionString = "Provider=MSDASQL.1;DSN=" & TT_DSN & ";" & "TTC_SERVER=" & TT_SERVER & ";" & "TTC_SERVER_DSN=" & TT_SERVER_DSN & ";" & "UID="& TT_UID & ";" & "PWD=" & TT_PWD & ";"
    mCnTT.Open
    When ran from 64-bit application it will work fine.(I tried it on a stand-alone vbscript)
    My problem is that I need this code to work on a 64-bit system server, BUT from a 32-bit application (QTP)
    and I'm getting the following error:
    "[Microsoft][ODBC Driver Manager] Data Source name not found and no default driver specified"
    any idea how to build a connection string that will work? Maybe use a differnet provider?
    is MSDAORA provider supporting timesten?
    any suggestions will be welcome!
    thanks,
    Rachel

    So you will be running a 32-bit application on 64-bit Windows connecting to 64-bit TimesTen on a Unix server; is that correct? Assuming that it is then you need to:
    1. Install the 32-bit TimesTen Windows client rather than the 64-bit TimesTen Windows client (a TT 32-bit client will work with a TT 64-server just fine)
    2. Use the 32-bit ODBC Administrator applet to configure the DSN rather than the default 64-bit applet
    Point (2) is especially important. 32-bit and 64-bit ODBC DDNs are held in completely different places in the Windows registry; 32-bit Apps can't see/use 64-bit DSNs and vice versa.
    None of this is directly related to TimesTen; this is all standard Windows 64-bit functionality and issues.
    Chris

  • Issue with the String return from com.sap.aii.af.mp.module.ModuleData

    Hi Friends,
    We are developing Adapter for XI using java, XI is giving String in the form of ModuleData, we r getting the String from ModuleData but in the logic we need to split the String in parts based on character '…', but I observed that in the communication channel symbol is showing as ' '.
    We have written the java code based on '…' but splitting is not working, then I tried with the following code
    String[] molecules = null;
    if(filedata.indexOf(" ") != -1){               molecules = filedata.split(" ");
    }else if(filedata.indexOf("?") != -1){
                    molecules = filedata.split("?");
    }else if(filedata.indexOf("…") != -1){
                    molecules = filedata.split("…");     
    Still it is not working, please help in case of ModuleData text splitting..
    Thanks in advance.
    Satinder Saini

    Check with a hex editor, what the  ' '. really is.
    Maybe it is a tab? Then you can use "\t" in a Java progam.
    See also here:
    http://en.wikipedia.org/wiki/ASCII#ASCII_control_characters
    Regards
    Stefan
    Edited by: Stefan Grube on Mar 26, 2008 2:22 PM

  • Issues with Characters & Strings

    Cant quite convert these funny characters into some string or chars.Ive tried almost everything: toString, charValue, charAt, String.valueOf(),charArray(), nothing is working at this point,and I need help.
         public static void main(String args[]){
              randomOps ro = new randomOps();
              for(int i = 0; i < 4; i++){
                   char[] chars =  ro.randomOperators();
                   String string = String.valueOf(chars);
                   System.out.println("char operators are:" + string);
              }Here's the output that Im getting:
    C:\Java>java randomOps
    char operators are:?? &#9786;
    char operators are:&#9787;&#9787;&#9786;
    char operators are: &#9787;&#9787;&#9787;
    char operators are:   ??

    Here it is:
    public char[] randomOperators() {
                   Random random = new Random();
                   char[] randomChar = new char[4];
                                  for(int i = 0; i < randomChar.length; i++ ){
                                            char[] chars = new char[]{'+','-','/','*'};
                        //int r = random.nextInt(chars.length);
                        randomChar[i] = (char)random.nextInt(4);
                                            //randomChar = chars[r];
                                            //System.out.println(randomChar);
                        return randomChar;
    }

  • Issue with converting string to date object

    Hi all,
    I have a problem with sorting a list of dates in a table column. My dates are in the format 'yyyy-Mmm-dd'(Eg: 2009-Dec-23). Can someone help me how to sort the dates in this format. here is the code which i tried.
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-Mmm-dd");
              Date d1= new Date();
              Date d2= new Date();
              try {
                   d1 = dateFormat.parse("2006-Jun-09");
                 d2 = dateFormat.parse("2006-Apr-10");
              } catch (ParseException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
              System.out.println("converted date 1"+ d1);
             System.out.println("converted date 1"+ d2);
    Exception : Unparseable date: "2006-Jun-09"
         }Please someone help me how to pass this date in the right format.

    I believe twisai may have lost the documentation so he/she can figure this out rather than guess that "Mmm" means 3-letter month, first letter capitalized. Let me remind him of the link:
    [http://java.sun.com/javase/6/docs/api/index.html]

  • Having trouble converting array to spreadsheet string, storing the file and coverting back to array with complex numbers

    I am working with a network analyzer. I have arrays made of 5 columns the first consisting of an integer and the next four consisting of complex numbers. I am converting the array into a spreadsheet string and then saving the file using the write characters to a file VI. That seems to work well as when I open the file in Excel all the data is there. However when I try to reverse the process, open file and convert back to array, I loose some of the data. Specifically the imaginary parts of my complex numbers are all going to zero. I have narrowed down the problem to be in the conversion from spreadsheet string to array and vice versa. I
    think the problem may be with the 'format' input to the VI. I do not have an adequate resource for this so I am not sure what to put in to accomplish my task. Any takers?

    Hi Biz
    I don't think there is a direct way of converting a complex number to a
    string, so when you convert the array to a spreadsheet string, the
    numbers would be converted to real data.
    However, you could try separating the real and imaginary parts using the
    "Numeric: Complex to Re/Im" function, and then store these - either in
    separate files or in adjacent columns/rows in the same file. Then, when
    you read in the data again, use the "Numeric: Re/Im to Complex" function
    to put the two "halves" together.
    If you actually want Excel to interpret the numbers as imaginary, then
    you'll probably want to create a string for each complex number of the
    form "Re + Im*i" (after separating the Re and Im parts), by using
    "String:Format into String" with 2 numeric inputs and the format string
    "%f+%fi".
    Reading the data back into Labview then would require splitting the
    string into the 2 pieces by using "Stringcan from String" with 2
    numeric outputs (smae precision as original numbers specified by the 2
    Default Value inputs) and the same format string "%f+%fi", and then using
    the above-mentioned "Numeric: Re/Im to Complex" function. It worked for
    me, so if you can't follow what I am describing, send me an email and I
    can email you what I did (LV 5.1.1).
    Paul
    Biz wrote:
    > Having trouble converting array to spreadsheet string, storing the
    > file and coverting back to array with complex numbers
    >
    > I am working with a network analyzer. I have arrays made of 5 columns
    > the first consisting of an integer and the next four consisting of
    > complex numbers. I am converting the array into a spreadsheet string
    > and then saving the file using the write characters to a file VI. That
    > seems to work well as when I open the file in Excel all the data is
    > there. However when I try to reverse the process, open file and
    > convert back to array, I loose some of the data. Specifically the
    > imaginary parts of my complex numbers are all going to zero. I have
    > narrowed down the problem to be in the conversion from spreadsheet
    > string to array and vice versa. I think the problem may be with the
    > 'format' input to the VI. I do not have an adequate resource for this
    > so I am not sure what to put in to accomplish my task. Any takers?
    Research Assistant
    School of Physiotherapy, Curtin University of Technology
    Selby Street, Shenton Park, Western Australia, Australia. 6008
    email: [email protected]
    Tel. +61 8 9266 4657 Fax. +61 8 9266 3699
    "Everyone who calls on the name of the Lord will be saved." Romans 10:12
    "For all have sinned and fall short of the glory of God, and are
    justified freely by his grace through the redemption that came by Christ
    Jesus." Romans 3:23-4

  • How do i convert a spreadsheet string to an array of double with out using spreadsheetstringtoarray.vi?

    Hi
    When I use spreadsheet string to array on a spreadsheet string, I get zeroes in between the numbers. The original string has a number, a tab, and another number and I want it convert to double precision format retaining the spreadsheet string format.
    How can I do this?
    Thank you.

    adrianT wrote:
    Hi
    Thanks for that.
    But your method produces just one column of data. I need two.
    Thank you.
    When I use the vi on the data you provided, I get two columns. You can see that by yourself on the attached vi, where I have saved the calculated results as default values (there is an additionnal modification to read directly a file). Are you making tests on different sets of data ? Could you give me an example of what's returned by my vi. Or are you using a modified version of my vi ? In this last case, could you post it ?
    CC
    Chilly Charly    (aka CC)
             E-List Master - Kudos glutton - Press the yellow button on the left...        
    Attachments:
    Clean text 3.vi ‏45 KB

  • Converting from spreadshet string to array and then back to spreadsheet string

    My questions is; why is the Spreadsheet string to array function creating more data than the original string had when you change the array back into a spreadsheet string. Im trying to analyze a comma delimited file using array functions since my column and row size is constant, but my data varies. Thus my reason for not using string parsing functions which would get more involved and difficult. So, however, after i convert to a 2D array of data from the comma delimited file I read from, and then I convert back to string using the Array to Spreadsheet String, I get added columns to the file, which prevents another program from receiving these files. Also, the data which I am reading is not all contiguous, it has gaps in some places for empty data. Looking at the file compared to the original after it has gone from string to array and then back to string again, looks almost identical except for the file size which got larger by 400 bytes and where the original file has empty spaces, the new file has a lot of commas added. Any idea?
    Charles

    The result you get is normal when the spreadsheet string contains rows of uneven length. Since the array rows have the same number of elements, nil values are added during the coonversion. And of course, the back to string conversion keep those added values in the string, with the associated commas.
    example : 3 x 3 array
    1,2,3
    4
    5,6,7
    is converted into
    1 2 3
    4 0 0
    5 6 7
    then back to
    1,2,3
    4,0,0
    5,6,7
    Chilly Charly    (aka CC)
             E-List Master - Kudos glutton - Press the yellow button on the left...        

Maybe you are looking for