Writing arrays in to excel

Helo..
I have sampled sine and cosine waves (4096 samples)  and the sampled values are in two different arrays. How can I write those arrays in to two different columns in excel sheet. I am using labview 8.2.
post the appropriate vi. 
Thanks in advance. 
Solved!
Go to Solution.

Not to beat a dead horse, but this method will not work, or not work well, in some cases.  For example, you can't use the write to spreadsheet file function if you want to  write to a specific worksheet within a workbook.  Also, the "Write Table to XL" VI is extremely slow for writing large chunks of data - it's writing data cell by cell so that can eat up processor time as the spreadsheet grows. 
A more efficient way is to use the "Value2" method of the ActiveX Range object.  This way you can write a huge set of data to Excel in a second or two.  I've attached a simple version of a VI I use as an example.
Greg
Certifed LabVIEW Developer
Attachments:
Write 2D array to Excel.vi ‏12 KB

Similar Messages

  • Time Stamp problem while writing data into the excel file

    Hii, All
                  I am taking the data from the DAQ card of the TOPSCCC with the 8 ms of scanrate for each channel and there are total 16 no of Analog channels in the Card, now i am acquiring the data from the card, time stamping it and writing it into the excel file, which is tab delimited, now the problem is, the data which are in the excel file have the same timestamp for 4 to 5 continuous records, instead we want each data with the different and continuous time stamp with same difference of time stamp between two records, mean if it is difference of 8 ms then it should be the 8 ms for all, but here it is taking the differnce of 16 ms for two samples and giving same time stamp for four to five records and that shouldn't happen, here i am attaching my vi, drivers for the cards and Excel file with the data, can you please give me any suggestion how to do it?
           Please help me i require this suggestion as early as possible, i am requiring it urgently.
    Thanks in Advance,
    Nishant
    Attachments:
    2026vi.llb ‏319 KB
    2026_ScanMultAD_Demo_time.vi ‏80 KB
    Data.xls ‏357 KB

    Hello Nishant,
    that's what I meant:
    Message Edited by GerdW on 05-16-2006 10:32 AM
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome
    Attachments:
    timestamp-array.png ‏2 KB

  • Writing two arrays to a Excel Spreadsheet

    Guru's
    I am trying to take information from two arrays and write them to a spreadsheet. One array generates the headers information for the columns, the other array is a random number generator. The number of columns and rows are input from the front panel. The first column of the chart is time at some multiple (interval) input from the front panel
    The problem I am having is timing the data out of the loop at the same time so they write together. One loop writes first and the other is left out. The data is going out to an excel spreadsheet. The data is correct for the headers and the columns, but won't write together.
    I have only been using LabView for six weeks and have spent a good portion of this weekend working on this problem.
    Attached are screen shots and the .vi of the problem. Explanations of each loop are writen in the block diagram.
    Thank you for your time and help!!
    Newbie2
    Attachments:
    writing to excel problem.doc ‏195 KB
    Writing to excel problem.vi ‏27 KB

    First let's talk about the code flaws:
    Placing a text decoration over a path constant does not turn it into a valid path constant.
    All your controls belong outside the loop, because it would be really bad if they could change during running of the loop. This is also less work, because LabVIEW does not need to re-inspect the control during each iteration.
    Your while loop should be a FOR loop because the number of iteration can be calculated before the loop starts. This eliminates checking for termination.
    You are not writing any excel files. You are just writing an ASCII table, but you possibly force excel to open it via a fake file extension. (this might be OK, but make sure to NEVER save it later as excel or the file structure would change dramatically).
    "# of rows" and "# of machines" should be integers (blue).
    Don't be afraid to brance a wire. You don't need any local variables if you do so.
    To determine the order in which the segments are written to the file can be determined by dataflow if you wire it correctly. Wire the path to the write function that needs to write first. Then use the path output of this function and wire it to the next instance. Now the second instance must wait until the first one is finished.
    (Currently you are branching the path wire, and the execution order is random!)
    LabVIEW Champion . Do more with less code and in less time .

  • Writing array to Excel with ActiveX

    Common question I suppose, but I'm still having issues despite reading several posts about the issue.
    Problem is I'm trying to write a 1D array of data to 1 column in an excel document. However, unless I add an artificial column (of blank values or some other bogus #), ActiveX only writes the 1st value of my array to the column.
    Look at the attached. In Picture 1 I add an articial column and everything writes fine. In Picture 2 I don't add this column and only the 1st value of the array gets written in each row.
    Suggestions?
    Thank you.
    Solved!
    Go to Solution.
    Attachments:
    images.jpg ‏233 KB

    I haven't done much with Excel and LabVIEW by way of ActiveX.  Creating a small VI and duplicating what you show in your screenshot, I see the same behavior.
    I believe that Excel interprets a 1-D array as something that runs horizontally.  So a 1-D array consists of a single row of cells and N number of columns.
    (Actually LabVIEW interprets a 1-D array like this as well, but it allows you to show an array onscreen either vertically or horizontally.)
    Converting to a 2-D array and transposing is what you need to do to have that 1-D array be treated as a single column of cells.
    Note that you don't have to use build array and append an empty array to it.  You can just use build array as is and it will turn a 1-D array into a 2-D array.
    Attachments:
    Example_VI.png ‏22 KB

  • Writing double precision to Excel

    Hi folks,
    as others, I am having problems with writing doubles to Excel with the new Report Generation Toolkit.
    My problems are due to localized decimal points and as far as I figured out, this makes it impossible to use the "EasyExcel Table.vi", feeding in a numeric array as designed. It might be that this problem is due to the writing, then backreading and rewriting of the table, programmed by NI in the "Excel_Insert_Table.vi" (fig. 1). At least the code does not make sense to me .
    A solution like converting the numbers to text myself and then sending the text to Excel becomes very clumsy, when I have to check for the country settings, convert points to commas and vice versa and in addition, I did not find out how to read these settings programmatically.
    Now, I just recently figured out an elegant solution to the problem that I implemented for the previous version of the Toolkit: Don't convert the numbers but transfer them to Excel in binary format (fig. 2).
    Excel (2003 at least) understands these numbers perfectly. I thus programmed a custom "EasyExcel TableHL.vi" (including its subVIs), in order not to change the Toolkit library.
    Now, due to problems with Office 2007, I have to upgrade to the new toolkit version and I do not know, how to deal with the new object oriented approach.
    It is clear, the easiest solution to my problem would be, NI fixing it by writing non converted numbers to Excel (as you expect from the appearance of "EasyExcel Table.vi" ).
    A second solution would be to modify the the toolkit, which I don't like.
    The third way then is to learn OOP, build a new class with the desired functionality ........ , leaving the toolkit untouched.
    Now my question is: Does anybody have a fourth possibility or can anybody give me a hint, how laborious it will be, to dig into OO-programming to do the above described work?
    Thank's in advance.
    Herbert
    Attachments:
    Excel_Insert_Table.jpg ‏123 KB
    write DBL to Excel.jpg ‏118 KB

    Hello Marian,
    the toolkit I am using is 1.1.3 together with LabVIEW 8.6.
    Now, since I do need a solution due to customers waiting, I tried to modify the Office-library and I succeeded.
    This means, I am very thankful to NI that it did not protect all the VI's by password, as it did with the classes. This fact enabled me to implement my solution into NI's VI's and become unsensitive to  the country settings of the customer.
    Now, since only "non-protection" made this simple solution possible, I would like to ask NI to protect as few code as possible. I know, NI does so in order to protect it's intellectual property. On the other hand, open code provides the user the possibility to correct bugs himself, which can be "vital" in some situations (according to my experience, this happens seldom, but it does happen).
    Thank's
    Herbert

  • Problem with writing continuous data to excel using using Report Generation vi's

    Hey Everyone,
    I am trying to read the data from DAQ and write to excel continuously using Report Generation vi's. 
    But when I run the VI, it writes only one interation of the while loop (gathering data from DAQ continuously) and doesn't append the data into the same file when I run it again after stoping the VI. 
    I have attached the VI i created. Please let me know if you have any idea to solve this issue. 
    Thanks
    Attachments:
    sample 5.vi ‏35 KB

    There are two problems with your VI.  First, the basic logic of writing/appending to a file (Excel, TDMS, anything) should go something like this:  Open the file, position yourself at the end of the file, then, in the loop, acquire data and write it to the file until you are finished with data acquisition.  When you exit the acquire/write to file loop, then close the file.  In particular, the opening and the closing of the file should not be inside the loop.
    As others have pointed out, writing to Excel might not be optimal, particularly if you are acquiring data at a high rate (and would therefore be writing a lot of data). We actually use Excel in our data acquisition routine, mainly reading from a WorkSheet to get the parameters of a particular stimulus, but also writing the outcome of the response to the stimulus.  As it happens, our "acquisition rate" in this example is on the order of several samples per minute, so there's no problem using Excel (we also sample 16 channels of analog data at 1 KHz -- this gets written as a binary file).
    Second, if you really do want to use Excel, use the (existing) Excel file to which you want to append as the "template" argument of the New Report function.  Then use the Excel Get Last Row function to position yourself at "end of file", as noted above.
    Good Luck.
    Bob Schor

  • How to lookup a value in a 2D array from an Excel file - Dasylab version 12 Pro

    Hi, I am new to this forum and am looking for some advice on a worksheet I'm trying to construct.  I have an Excel spreadsheet that is basically a 2D array, and I want to use Dasylab v12 Pro to be able to import a value from this array based on user selections from within the Dasylab worksheet.
    Column A lists 200+ diesel engine models.  I've shown 9 in my Excel attachment...one model per row (shaded in yellow), and each engine model can be run at several speeds (shaded green in columns B thru F).  For an engine in a given row, combined with a chosen operating speed gives you a corresponding horsepower (blue shading).
    I have this Excel sheet saved somewhere on my C:/ drive, and what I want to do is when the user starts the Dasylab worksheet he will select from a drop drown menu to choose the engine model (ie A, B, C, etc) and another drop down menu to choose the speed (ie 1470, 1760, etc).  I know that I can make a drop down menu with a Coded Switch within Dasylab, however it seems only 16 choices can be made from each switch, so for my 200 engine models I will need 13 switches!  I know I can assign a text description like "Engine A" to a numerical value within that coded switch.  Somehow I need to take those two selections made within the Dasylab experiment, and read this Excel file (ie my database of all of these 200 diesel engine models) as a 2 dimensional array by row and column to spit out the data value (the blue numbers) back into Dasylab.
    The goal is to take the engine model, speed, and the horsepower obtained from the array search and write these to an .asc file that I will create a running log of this data.  So, after the test page is run 50 times it will have 50 rows of data containing these 3 parameters.  There is some other test data taken from my data acquisition that goes along with this, however that's not part of my 2D array predicament.
    I'm taking a guess that I need to do something with global strings & variables, and some how import them and export them with an ODBC in/out module.  This is something I've just never worked with before so I am a bit lost.  Obviously I can just make the user type in the engine model and speed as a startup parameter at the start of the test and save that to a variable or string, but I want to make it idiot proof so that the two selections (ie row and column) can be chosen from a pre-set list and will yield my data value.  Everything else related to Dasylab I am pretty proficient with.
    Thanks,
    Mike
    Attachments:
    engine 2D array.xlsx ‏10 KB

    This would be the best way.
    Also, with version 13 they started using Phyton to create custom modules that can be programmed in DASYLab.
    We arte learning this right now and I know that you can use standard message dialogs with that as well.
    I would suggest to you to download a demo of V13 and take a look at the Pyton module.
    Also, usually DASYLab system intgretors like us, can provide services also on things like this including Excel programming for pre and post analisys 
    Tom Rizzo
    InSyS Corp.
    www.insyscorp.com
    Your DASYLab integrator

  • How to export an array to an excel-sheet

    Hallo,
    does somebody knows how i can write an String[][]-Array in an simple Excel-Table, or knows someone a source where i can find information about the xls-fileformat?

    POI has, however, a programming interface. Relying on the file format alone, you are reinventing the wheel.
    In a production environment I use the comma-separated-value file format to "mock" Excel files and this works.
    Good luck anyway!

  • Declare Array in OLE Excel

    Dear all,
    How can I declare a variable type Array in Excel Ole ABAP ??
    Dim a As Variant
    a = Array(11, 12)
    How can I declare in ABAP ??
    Thank you

    Note 633105 - OLE automation: ABAP type for OLE array parameters
    Symptom
    If the method of an OLE object contains an array parameter, there is no suitable ABAP data type for the parameter.
    Reason and Prerequisites
    Array is not supported as a data type for OLE parameters in ABAP.
    Solution
    None

  • Help: writing large data to excel using java

    Hi All
    I had a question writing a 6000 rows of data with 20 colums to a excel sheet. I am using Apache POI
    When we are writing some data to a file we store the data in an stringbuffer and then write the data to the file all at once.
    Is the same possible with excel? if so how?
    And what is the best way of wring data to an EXCEL file considering the above data into consideration.
    Please guide me thanks in advance.
    Regards
    Diana

    Text Files and Excel formatted files treat things differently--basically no, you cannot group multiple fields into one string: Excel has the concept of cells that you need to write the data into and will act similar to fields in a DB. On the other hand, you can drop the Excel formatting and write CSV files and Excel will load them just fine. With a CSV file you can write it all to a String, StringBuffer, StringBuilder or what ever String type of object you want and write an entire line at a time.

  • How to make an array with ActiveX Excel using Excel_RangeSetValue2?

    Hello,
    I want to make an array on Excel. For that, I'm using two functions : Excel_WorksheetGetRange and Excel_RangeSetValue2.
    I write the array on Excel file but only the first case of the array is copied.
    Here, a part of my program :
    char * DataToWrite = {"A", "B", "C", "D"}
    char cCell[10];
    VARIANT             vCell, Data;
    ExcelObj_Worksheet hWorksheet;
    ExcelObj_Range      hRange;
      CA_VariantSetCString (&vCell,cCell);        //cCell = A1:A4
      Excel_WorksheetGetRange (hWorksheet, NULL, vCell, CA_DEFAULT_VAL, &hRange);
      CA_VariantSetCString (&Data,DataToWrite );
      Excel_RangeSetValue2 (hRange, NULL, Data);
    Here what I obtain when I'm compiling on Excel file :
    A
    A
    A
    A
    Solved!
    Go to Solution.

    You should use other instructions to fill the range of cells:
    strcpy (msg, "A1:A4");
    CA_VariantSetCString (&MyVariant, msg);
    Excel_WorksheetRange (ExcelWorksheetHandle, NULL, MyVariant, CA_DEFAULT_VAL, &ExcelRangeHandle);
    Excel_RangeActivate (ExcelRangeHandle, NULL, NULL);
    // Create a SafeArray from array of data
    CA_VariantSet2DArray (&MyVariant, CAVT_CSTRING, righe, 1, array);
    // Transfer data to Excel range
    Excel_SetProperty (ExcelRangeHandle, NULL, Excel_RangeValue2, CAVT_VARIANT, MyVariant);
    ClearObjHandle (ExcelRangeHandle);
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?

  • Reading from an Excel Doc and Writing to a new Excel using jackarta's POI

    Hi, could anyone know how to read a line from an existing Excel document and writing it to a new Excel document?
    Please reply soon.
    Thanks.

    Flex, when run in the Flash Player in a browser, cannot
    access ANY client resources, including the file system.
    In your example, recipes.xml is loaded into your app at
    compile time, from the server.
    In order to write that file back to the server, you must have
    some server-side functionality. This functionality can be
    implemented in JSP, ASP, CF, PHP, Java, etc.
    Here is an example, that loads an xml file from the server,
    edits it, and saves it back. The example shows both JSP and ASP.Net
    back-end code. Note: the xml editor part makes if much more complex
    than is needed just to load/and save a file. You will be able to
    pull that portion our of the rest if you want.
    http://www.cflex.net/showFileDetails.cfm?ObjectID=544&ChannelID=1
    Tracy

  • How can i run my vi writing its output in Excel in a real time?

    My vi is open and excel is open while my vi is inserting the data in excel.
    Thank You
    (can i have a simple example?)

    Are you running LabVIEW or LabVIEW Real-Time?
    To write data from LabVIEW to Excel, you can either use Write to Spreadsheet VI from the File I/O palette, or use activeX technology. Additionally, if you have the Report Generation Toolkit you could create Excel reports with LabVIEW.
    Here are some links that should help you.
    Writing Rows to Excel 97 and Excel 2000 Using ActiveX
    Creating a Report in Microsoft Excel Using the LabVIEW Report Generation Toolkit: Introduct
    ion
    Zvezdana S.

  • How to save data (DBL array) in a excel file

    Ok, I am new into Labview.  This question may seem easy for you guys, but for me, it is quite a challenge.  I have current coming out of a loop.  When the program stop, I would like to be able to save it as well as the time when it has been taking and the average current in a excel file.  When my labview code stops, how do I do to get a  pop up window which ask me where and what name to save it to? How do I get so that on the top of each column, it says : current (Amp)    Time (ms)   Average Current (amp)?
    thank you very much,

    Hello,
    We love to see people catch the LabVIEW spirit and anything we can do to help
    you through the initial learning process is our pleasure.
    As KC suggested saving the file as a .csv is a good idea,
    you can also save it as a txt file and open it with Excel specifying a delimiter
    for the columns.
    There is a really good example you can find in the LabVIEW
    example finder if you search for the keyword ‘file’, the example is called “Write
    to Text File.vi”. They use a Get date/time String to record the time when data
    is acquired.
    I have attached a simple Write to File picture of a VI that
    takes a random number and writes it to a file. When I run the VI, a popup asks
    me what I want to call the file. The first part writes the heathers on the
    columns and inside of the for loop I save the data. Underneath the block diagram
    is a picture of the output file when I specify the number of samples to be five.
    If you want your file to be on a very specific format, you
    can create a template file, read it in LabVIEW, and then add your data to it
    and save it to a new file.
    Hope this can get you started with your program.
    There are a lot of good tutorials online on how to
    get started using LabVIEW. Here is the link to a three hour
    introduction course:
    http://zone.ni.com/devzone/learningcenter.nsf/03f7c60f17aad210862567a90054a26c/60c2782788a811c986256cd50001a0a6?OpenDocument&node=200067_us
    We are also comming out with LabVIEW 8 in November and we have a program called LabVIEW Standard Service Program
    (SSP) that allows you to get automatic upgrades and updates. Please let
    me know if you are interested in knowing more about it.
    Good luck,
    Tica Taveras
    Applications Engineer
    National Instruments
    Attachments:
    SaveData.bmp ‏1475 KB

  • Writing arrays to text data with continious time stamp

    Hi Friends,
    I have the following problem.
    I want to create a text file looking like this:
    12,30,10, 10:30:00     12.05.2007
    12,31,10, 10:30:00,1  12.05.2007
    12,32,10, 10:30:00,2  12.05.2007
    12,33,10, 10:30:00,3  12.05.2007
    12,34,10, 10:30:00,4  12.05.2007
    12,35,10, 10:30:00,5  12.05.2007
    12,36,11, 10:30:00,6  12.05.2007
    12,37,12, 10:30:00,7  12.05.2007
    12,38,13, 10:30:00,8  12.05.2007
    12,38,16, 10:30:00,9  12.05.2007
    12,39,18, 10:30:01,0  12.05.2007
    12,39,18, 10:30:01,1  12.05.2007
    12,39,18, 10:30:01,2  12.05.2007
    the first 3 values are read from a file ,recorded as array and than plotted in chart.
    the beginning time (e.g 10:30:00  12.05.2007) is also read from a file and set as beginning of the chart with a property node. The problem is here , after I set the beginning time to the Chart I have nothing to do with it for the rest values, since samples/sec is also sent to chart.
    So how can I write the a txt file including the time stamp with ms incrementations?
    Thanks alot for your responces.
    john

    Hi John.
    I would use a Time Stamp and "Format Into String" with e.g. %<%.1X>T.
    Syntax details are in the LabVIEW Help - Search for "Format Specifier Examples".
    Regards, Guenter

Maybe you are looking for

  • I can no longer scroll on my iMac in Mavericks

    For some reason completely unknown to me, I suddenly can no longer scroll, or even see scrollbars on my iMac, running Mavericks. It's been perfectly fine for months and just yesterday...poof! No scrolling. At first I thought it was limited to Safari,

  • Want to make a bootable DVD for Grandson to use.

    I picked up a eMac at an auction and want to give it to my Grandson so he will stay off his dad's Powerbook G4. I bought the OSX 10.4 install disks so I can do a legal install. However, I plan on limiting what is installed as a lot is stuff he doesn'

  • Efficent method to sort data from tab delimited text file

    I am currently writing a program to sort through data that was acquired and display it on a graph and some other indicators.  The file is a tab delimited text file with possibly 100,000s of data points.  the current method that I have tried using was

  • Why some docx document can't be opened by Pages '08?

    Why some docx documents can't be opened by using Pages '08?

  • Coverting Videos

    I move music videos from "my videos" in my computer to my itunes and when i sync ipod it tells me that video cant go onto ipod. then i right click on the video in my itunes & "convert selection for ipod". it converts but has no sound on my ipod, soun