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.

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

  • 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

  • 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

  • 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

  • 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...        

  • Array To Spreadsheet String, Empty Delimiter

    The Array To Spreadsheet String function does not accept an empty Delimiter, it uses the Tab character in such case.
    The same is true for the Spreadsheet String To Array function (but of course this function cannot work without a Delimiter).
    I would appreciate one of the following options:
    to allow an empty separator for both functions (for Array To Spreadsheet String this can easily work obviously; for Spreadsheet String To Array you might see an empty string delimiter between each two adjacent characters similar to the Search and Replace String function with an empty search string);
    to document that behaviour properly;
    I would prefer the first option espacially for the Array To Spreadsheet String function. What do you think?

    Hi aschipfl,
    some thoughts about your suggestion:
    - When you want to suggest improvements to LabVIEW you should post in the Idea Exchange.
    - NI will not change the behaviour of functions existing for a long time…
    - NI will probably update the LabVIEW help for that function…
    - a spreadsheet string needs some kind of delimiter, what's the purpose of creating a spreadsheet string without them?
    When you really need a "Array to Spreadsheet String" without delimiters you could take this approach:

  • Array To Spreadsheet String -- Convert EOL Option

    The Array To Spreadsheet String and Spreadsheet String To Array functions should provide an option for (not) converting EOL (end-of-line) to platform-dependent ones. I am thinking of something similar to the Write/Read Text File options where you can place a checkbox in the context menu "Convert EOL". As per default such checkbox need to be checked for compatibility reasons.
    Possibly another option/checkbox for not appending the final EOL would be nice, maybe "Final EOL" checked per default as well.

    Hi aschipfl,
    some thoughts about your suggestion:
    - When you want to suggest improvements to LabVIEW you should post in the Idea Exchange.
    - NI will not change the behaviour of functions existing for a long time…
    - NI will probably update the LabVIEW help for that function…
    - a spreadsheet string needs some kind of delimiter, what's the purpose of creating a spreadsheet string without them?
    When you really need a "Array to Spreadsheet String" without delimiters you could take this approach:

  • Spreadshee​t String To Array DBL Performanc​e Improvemen​t

    While developing and profiling a batch data-analysis program, I found that the "Read From Spreadsheet File.vi" function was where the majority ofthe execution time was spent.  Digging further, I found the time was spent in the "Spreadsheet String To Array" function.  Obviously I cannot look inside this function, but I wondered if I can somehow speed it up.  Attached is a Vi that illustrates what I came up with as an alternative.
    Basically using "Spreadsheet String To Array" only to split it up to a 2D String Array, and then "Fract/Exp String to Number" to convert the strings to numbers.
    It consistently runs in just over 60% of the time of using Spreadsheet String To Array on it's own to do the conversion.
    I am curious as to why using the two functions is quicker than just the one on it's own? Perhaps NI can improve the internals a bit?  Or perhaps it is not a fair comparison?
    Labview 8.6f1 Win XP SP2
    Message Edited by pauldavey on 03-25-2009 02:55 PM
    Attachments:
    Speed Test Spreadsheet String to Array.vi ‏26 KB

    Adding a couple of other conversions to test against i noticed that:
    1. Scan from string through a double loop was the slowest
    2. Scan Value was slightly faster
    3. Direct conversion through Spreadsheet to array as in OP
    4. 2-step convert through Fract/Exp.
    Could it be that Spreadsheet to array uses Scan Value internally?
    /Y
    LabVIEW 8.2 - 2014
    "Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
    G# - Free award winning reference based OOP for LV

  • Spreadshee​t string to array notation

    Hi all,
    I am using the spreadsheet string to array function and basically my problem is as follows:
    My inputs are in scientific notation so I use this in string format. The data is separated with a ",". What I get is just the argument rounded.
    As I just realized I didn´t make myself clear I´ve attached a photo of the problem. Notice that probe 4 is the input from which I want to build the array, and probe 5 is the output. I just have the 9 but what happens with the rest of the number?
    PD: I´ve tried many formats but none of them seems to work.
    Thank for your help
    Solved!
    Go to Solution.
    Attachments:
    notation.png ‏145 KB

    Your system is set up to use a comma (,) as the decimal point?  Try using "%.;%^.3e" for your format.  The "%.;" tells the scan to use the period as the decimal point.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • 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

  • Parse string into array for comparison

    Hi All,
    I am trying to parse a string message into an array of numbers so I can check if my event was successful.
    \FF\FE\01\FD\02\00\00\00
    I know I just need to read through and discard the \, but I don't know how to do that in Labview. I just need to check if the 6th byte = 00 or not.
    Thanks! I mostly need help with parsing in labview.

    Assuming this is a plain ASCII string containing the letters 0..F and "\" as delimiter, you can simply used "Spreadsheet string to array" with the following settings:
    Type= 1D U8 array
    format= %x
    delimiter= "\"
    One problem is the extra delimiter at the beginning, so use array subset to skip the first element.
    (EDIT: Ahh, Darin beat me with a similar solution. Mine's a little easier ).
    Message Edited by altenbach on 08-06-2009 04:30 PM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    StringToArray.png ‏13 KB

  • Spreadshee​t string to array slow?

    We have an apllication here where we would like to save all our data 120
    files with 4M each and then read it back.
    I ve changed now to zipped files, but reading from the disk seems not to
    be the problem. I used 'profile' to analyze the time consumption. I
    think it might be the 'spreadsheet string to array VI' which makes it so
    slow, 1 second is a lot to sort 450k numbers. (BTW its a win2000 PC of
    this year)
    Any hints how to improve it?
    Best Regards
    Urs Bögli

    hi,
    I do this small program. Program generate, write and read array with double precision. I generated array with 1.000.000 rows and 10 columns. Read is fast in this program, because file is 'cached' in Windows Virtual Memory.
    When you close LabVIEW and try read file with second VI on my PC I need 3 second for this array [on the disk have file 80MB].
    It is programs in LabVIEW 7.0
    Attachments:
    readArrayFile.zip ‏186 KB

Maybe you are looking for

  • Daily sales(qty of material delivered to cutomer)

    How can i get daily sales(qty of material delivered) for last one year. Regards, vivek

  • "Import Material Indicator" 0HC_IMPMIND ?

    Hi Experts! I need load the IO "Import Material Indicator" (0HC_IMPMIND ), this is an 0material attribute, but is not been loaded.. How can I do to load this? Thank you in advance!

  • Using DDE package

    Dear all, i'm using oracle 9i version 9.2.0.1.0, i want to get data from an excel fie excel version 2003. i'm using the same code in the help DECLARE      CONVID PLS_INTEGER; BEGIN CONVID := DDE.INITIATE('EXCEL','C:\abs.xls'); DDE.REQUEST(CONVID,'D4'

  • Materialized View - Refresh in 10g FAST .. refresh in 11g SLOW

    Sorry I'm not able to paste anything. The customer moved their database from 10g to a 11gR2 database. They created the MV in the new system and now it takes 26 hours to refresh as opposed to 15 min in the old 10g database. Just looking for a game pla

  • Under applications, "mailto" has disappeared and I am unable to send links.

    I recently had to reformat my hard drive and reinstall (among other things) Firefox. Fine. Then I was asked if I wanted to upgrade, which I did. A day or two later, I wanted to e-mail a link to several friends and when I clicked on "send llink" under