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

Similar Messages

  • How do I pass an array of strings? (Help Me... Please!!! .Read Me....)

    Dear All.
    Help Me...
    English is not very good. Google translator is used.
     How do I pass an array of strings?
    Please refer to the VB program
     ===========================================
    Private Sub m_btn_Click()
        Dim nReturn As Long
        Dim sPpid As String
        Dim sMdln As String
        Dim sSoftRev As String
        Dim nCount As Long
        Dim saCCodes(2) As String
        Dim naPCount(2) As Long
        Dim saPNames(10) As String
        sPpid = "PPID001"
        sMdln = "Mdln"
        sSoftRev = "Rev001"
        nCount = 2
        saCCodes(0) = "1"
        naPCount(0) = 5
        saPNames(0) = "Param001"
        saPNames(1) = "Param002"
        saPNames(2) = "Param003"
        saPNames(3) = "Param004"
        saPNames(4) = "Param005"
        saCCodes(1) = "2"
        naPCount(1) = 5
        saPNames(5) = "Param006"
        saPNames(6) = "Param007"
        saPNames(7) = "Param008"
        saPNames(8) = "Param009"
        saPNames(9) = "Param010"
        nReturn = m_XGem.GEMReqSend(sPpid, sMdln, sSoftRev, nCount, saCCodes(0), naPCount(0), saPNames(0))
        If (nReturn = 0) Then
            Call Me.AddMessage("[EQ ==> XGEM] GEMReqSend successfully")
        Else
            Call Me.AddMessage("[EQ ==> XGEM] Fail to GEMReqSend (" & nReturn & ")")
        End If
    End Sub
    =================================================
    nCount, naPCount enough saCCodes, saPNames value must be sent.
    How to handle an array of strings in LabView is impatient.
    I want to VB program implemented in LabView.

    Have you actually tried to right click on the according node parameter and select Create->Constant or Create-Control??
    And I don't see any string array in the parameter list. That are all simple strings and the VB code in your first post clearly shows that the call to the function only indexes the first element of those arrays to be passed to the function, not the entire array.
    If the function really reads arrays despite being declared as only taking strings then it is using some weirdo VB trickery and there will be no way to replicate that in LabVIEW.
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Convert an array of strings into a single string

    Hi
    I am having trouble trying to figure out how to convert an array of strings into a single string.
    I am taking serial data via serial read in a loop to improve data transfer.  This means I am taking the data in chunks and these chunks are being dumped into an array.  However I want to combine all elements in the array into a single string (should be easy but I can't seem to make it work).
    In addition to this I would also like to then split the string by the comma separator so if any advice could be given on this it would be much appreciated.
    Many Thanks
    Ashley.

    Well, you don't even need to create the intermediary string array, right? This does exactly the same as CCs attachment:
    Back to your serial code:
    Why don't you built the array at the loop boundary? Same result.
    You could even built the string directly as shown here.
    Message Edited by altenbach on 12-20-2005 09:39 AM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    autoindexing.png ‏5 KB
    concatenate.png ‏5 KB
    StringToU32Array.png ‏3 KB

  • How do I write whole array in single write ?

    Hi Jgurus,
    I have fetched the record from Oracle and I wants to write those in a file . But problem is for every record in a record set file.writebytes write to a OS file. I don't want this single record write since it will write one by one. I have crores of records to fetch. Critical issue is performance. Can I picked up the rows in bunch and write to file ? I have stored (on smaller record size) all rows in array and now want to write the whole array to file in one OS write operation. Is there any way to do this ? Do any one suggest the better approach ?
    For real scenario file size will become around 300MB. I did it but it writes one by one record using next() from record set.
    Please advice.
    --RajivK.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    Can you give any example for a small String or int array. I have stucked at this point. I have wrote the array using for loop but for each iteration in a loop it writes. I have 5 lakh values stored in array. Can anybody show how do write whole array to os file in one write operation instead of getting one by one value and printing it. I am new to java please give details or sample so that I can understand.
    Thanks in advance.
    --RK.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • How can I resize an array of strings?

    I'm having a problem of not being able to use the CIN functions and therefore can't use the convenient resizing methods. I have tried to use NumericArrayResize to resize an array of strings, but it's not working correctly. Here's what I've tried most recently. I have tried many variations, so if you want to modify what I have posted, or just provide new code, please feel free.
    typedef struct {
    int32 dimSize;
    LStrHandle elt[1];
    } LStrHandleArray;
    typedef LStrHandleArray **LStrHandleArrayHandle;
    void someMethod(LStrHandleArrayHandle arrayOut) {
    // attempting to write the string "asdf" in the first element in the array. (1D array)
    int newSize = 1;
    MgErr e = NumericArrayResize(uL, 1L, (UHandle*)&arr
    ayOut, newSize);
    (*arrayOut)->dimSize = newSize;
    LStrHandle hdl = *(*arrayOut)->elt;
    long str_size = strlen("asdf");
    MgErr err = NumericArrayResize(uB, 1L,(UHandle *)&hdl, str_size);
    LStrLen(*hdl) = str_size;
    MoveBlock("asdf", LStrBuf(*hdl), str_size);
    The code above doesn't result in crashing labview at any time. The string "asdf" is not copied though. And, after being able to copy one string I would like to extend this to many elements in a 1D array of strings.
    Thanks!
    Naveen

    LabVIEW stores string arrays as an array of handles to those strings. To resize an array of strings you need to declare a new string in LabVIEW's data space, resize the handle array, and add a handle to your new string. Here is an example program which does this.
    -Aaron Marks
    National Instruments
    Attachments:
    resize.zip ‏252 KB

  • How do I resize an array of strings in a CIN ?

    I've been using a call to NumericArrayResize() to allocate enough memory for numeric arrays, but I now have an array of strings that I need to build in a DLL/CIN and pass back to Labview. Can someone point me to a snippet that will demonstrate how to populate an array of strings with data?
    Kindest,
    Warren

    Check the follwing example. It may be what you want:
    Using a CIN to Create an Array of Strings in LabVIEW
    http://zone.ni.com/devzone/devzoneweb.nsf/opendoc?openagent&AD517F5DCCAF70228625683A000A570F&cat=2F4F574886553A62862567AC004F032D
    Also, check the following example, as it provide an example on how to handle strings.
    Code Interface Node (CIN) That Converts a LabVIEW String to a C String, Modifies it, and Returns it as a LabVIEW String
    http://zone.ni.com/devzone/devzoneweb.nsf/opendoc?openagent&D978409908EA760D8625683A000B6B6E&cat=2F4F574886553A62862567AC004F032D
    Regards;
    EV
    www.vartortech.com

  • How can i combine an array of string and an array of integers ?

    i have an array of string data [to be used as header], and an array of multiple column integer vakues;i need them together in one file. 
    Am not able to combine them so that i can write them into a single file.
    Solved!
    Go to Solution.
    Attachments:
    string file input.txt ‏1 KB
    Test build_1.vi ‏13 KB

    There are a few ways you can do this.  What I recommend is:
    Open the file
    Use the Array to Spreadsheet String to turn your headers into a single string
    Write this to the file.
    Use the Array to Spreadsheet String to turn your numeric data into a single string
    Write this to the file.
    Close the file
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • 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

  • Passing String Which Has Single Quote Row/Value to a Function Returns Double Quoate

    Hi, I'm getting weird thing in resultset. When I pass String which has single quote value in it to a split function , it returns rows with double quote. 
    For example  following string:
    'N gage, Wash 'n Curl,Murray's, Don't-B-Bald
    Returns:
    ''N gage, Wash ''n Curl,Murray''s, Don''t-B-Bald
    Here is the split function:
    CREATE Function [dbo].[fnSplit] (
    @List varchar(8000), 
    @Delimiter char(1)
    Returns @Temp1 Table (
    ItemId int Identity(1, 1) NOT NULL PRIMARY KEY , 
    Item varchar(8000) NULL 
    As 
    Begin 
    Declare @item varchar(4000), 
    @iPos int 
    Set @Delimiter = ISNULL(@Delimiter, ';' ) 
    Set @List = RTrim(LTrim(@List)) 
    -- check for final delimiter 
    If Right( @List, 1 ) <> @Delimiter -- append final delimiter 
    Select @List = @List + @Delimiter -- get position of first element 
    Select @iPos = Charindex( @Delimiter, @List, 1 ) 
    While @iPos > 0 
    Begin 
    -- get item 
    Select @item = LTrim( RTrim( Substring( @List, 1, @iPos -1 ) ) ) 
    If @@ERROR <> 0 Break -- remove item form list 
    Select @List = Substring( @List, @iPos + 1, Len(@List) - @iPos + 1 ) 
    If @@ERROR <> 0 Break -- insert item 
    Insert @Temp1 Values( @item ) If @@ERROR <> 0 Break 
    -- get position pf next item 
    Select @iPos = Charindex( @Delimiter, @List, 1 ) 
    If @@ERROR <> 0 Break 
    End 
    Return 
    End
    FYI: I'm getting @List value from a table and passing it as a string to split function.
    Any help would be appreciated!
    ZK

    fixed the issue by using Replace function like
    Replace(value,'''''','''')
    Big Thanks Patrick Hurst!!!!! :)
    Though I came to another issue which I posted here:
    https://social.msdn.microsoft.com/Forums/sqlserver/en-US/a26469cc-f7f7-4fb1-ac1b-b3e9769c6f3c/split-function-unable-to-parse-string-correctly?forum=transactsql
    ZK

  • How do I make an Array Of Strings

    I want to make a program that will accept up to 10 lines of text but maybe less depending on the what the user want to put in... i can't seem to figure out where i put the number after a string... after String [10] text; or String text[10]?? am i even going about this correctly??
    thanks,
    Disco Hristo

    No, you are not.
    You need to do something like:
    String [] text = new String[ 10 ];Remember, Java creates all objects on the Heap. So you tell an array the appropriate size to be when you actually allocate an array with new.

  • How can I write a array to other subvi when the program running?

    Hello
    I am working on a project with labVIEW, In the programme I made, there is an Case structure. And there  are several subvI, each subvi
    belongs to one case.My question is when I process the data I a certain subvI, how can I wrtie this file(an array)  to another subvi and
    show the file name in a listbox?
    Many thanks

    You could try using a global variable or  a shared variable. 
    Brian

  • How to get correct byte array from String

    I have a string which contains binary value from 0 to 255. Now, if I use String.getBytes(),all the chars in the string which range from 128 to 160 will be convert to 63.
    What's the problem?

    You're assuming that you're working with Ascii values.
    You're actually working with Unicode values.
    When you use getChar() on a String, you get back a 16bit integer, the unicode index. When you do a getBytes() the Unicode values get mapped back to the default codepage of your machine.
    Eg. on an english pc, the default locale is Windows latin, codepage 1252. On non-english pcs, it could be any encoding scheme.
    If you're on a machine set up for a chinese locale, then the Unicode
    values get mapped to your chinese codepage. The extended ascii values,
    above 127 may not be defined in your codepage.
    Try String.getBytes ( "Cp1252" );
    Although I suspect that, whatever you're trying to do, it's probably not the right approach....
    regards,
    Owen

  • How do I write and read a specified number of bytes using C++?

    I need to send one byte commands followed by 1 or 2 byte data as well as read 1 or 2 byte commands from a RS232 device. How do I ensure that only 1 byte is sent for the commands or 2 bytes of data using VISA?

    Hey BMas05,
    Using VISA in C++ you can strings or bytes depending on which polymorphic version of the write you are using. One of the parameters for the VISA Write is the byte array and the number of bytes. This is if you are using the VISA classes for C++. You might have to have Measurement Studio to get these classes.
    There is a really good example that installs on your computer at C:\Program Files\National Instruments\MeasurementStudio\VC\Examples\Io\Visa\Serial Visa.
    This example shows how you can write just bytes or strings and you can select how many bytes to read back.
    I hope this helps out.
    JoshuaP
    National Instruments

  • Array of Strings?

    How can I make an array of strings?

    or, depending on what the heck you're talkingabout
    That's bad advice now that Java is in version 5.
    The standard loop is the for-each loop. If you don't
    use it you're going down in complexity which is a
    very bad thing according to the "premature
    optimization is evil" bunch. So use for-each if you
    don't want to be accused of "premature optimization"
    by jverd and yawmark and other prominent members of
    that bunch.Thanks for your advice. I use version 1.4.2. I did not intend to give bad advice. My post was targeted at someone who obviously did not understand "nuts and bolts" of java. It was not intended to be a lesson about "good design" or "real life applications" or "standard for loops in version 1.5". I gave an example that i feel is both adequate and appropriate for the target audience. It's intended purpose was to demonstrate very simple and basic concepts to someone who asked a seemingly simple and basic question that could possibly irritate a seasoned programmer like yourself. I have read your helpful posts in this thread and would welcome comments from yawmark and jverd also. I am sure they would be helpful to others who would read this thread in the future but their level of experience (along with Mr Warnerja) would perhaps be lost and uncomprehended by the OP. If in the context of the original question, you believe that my posts and simple examples are inappropriate, then would you kindly explain in terms that the OP can understand? Also explain (in this context) how my posts were wrong and meaningless.
    respectfully yours,
    Arbie

  • 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

Maybe you are looking for

  • I have iTune accounts under two separate Apple IDs.  Can I merge them into one account under one ID?

    I have iTune accounts under two separate Apple IDs.  Can I merge them into one account under one ID?  I have purchased music and video in both.

  • How to edit the content.opf  file of a FXL EPUB?

    I'm exporting a fixed layout epub and I cannot find out where the content.opf file is and how to edit it.  I'm trying to do the same thing that was done here: Indesign CC 2014 Fixed Layout export Can anyone point me in the right direction? I've googl

  • Issue with fill in the blank field and back button.

    I am working in CP4 AS2.  I have create a page of fill in the blank fields to simulate filling in a form.  On the next slide, I show the answers by extracting the variables into text boxes.  I have a back and a next button and instruct the user to re

  • Explain Plan for same query

    Same query is taking different times in two databses. Both dababases are similar being refreshed from one. Below are the the explain plan from both queries. Can anything be conclusive from this information. Second explain plan is for a faster executi

  • Previews in Captivate4 with CS5

    Has anybody had any experience using Captivate 4 with the CS5 programs? I installed CS5 this morning and now flash animations that are on my slides show up very small when I play the slide. When I preview the slide, the animations appear to work and