2.5 Getting Data from Worksheet Range

This tutorial shows how to get data to Labview from a rectangle range of a worksheet in Origin.

1. Run Origin. If Origin is already running, start a new project. Make sure that there is a Workbook with the default "Book1" and "Sheet1".

2. Select File: Import: Single ASCII from the menu, then find Gaussian.dat from <Origin installation folder>\Samples\Curve Fitting\. And make sure the Show Options Dilalog checkbox has been selected. Unwrap the (Re)Naming Worksheet and Workbook branch, disable the Rename Sheet with(Partial) Filename and the Rename Book with(Partial) Filename checkboxes. Then click OK button to import the file.

3. Run LabView and new a blank VI.

4. Put four integer controls to specify r1, r2, c1, and c2, which mean start row index, end row index, start column index, and end column index, respectively.

5. Put a 2D array with double indicators to show the data get from Origin.

6. Turn to Block Diagram window, and choose OA_ConnectToOrigin VI OA ConnectToOrigin App.jpg and place it to the window.

7. Select and place OA_FindWorksheet VI OA FindWorksheet.jpg, and then wire the Origin.IOApplication and Error IO connectors to the two VIs.

8. Add a string constant and assign to it the string [Book1]Sheet1, and then wire it to the Name connector of OA_FindWorksheet VI.

9. Select and place OA_Wks-GetRange VI OA Wks-GetRange.jpg, and then wire the Origin.Worksheet and Error IO connectors to the corresponding connectors of the OA_FindWorksheet VI.

10. Wire the four controls r1, r2, c1, and c2 to corresponding connectors of the OA_Wks-GetRange VI.

11. Since OA_Wks-GetRange VI get the data as Variant type, we use a Variant to Data SubVI Variant to Data.jpg to convert it to fit the output 2D Array, which is under Advanced\Data Manipulation\Variant palette.

12. When the wiring is complete, your Block Diagram and Front window should look like this: Tutorial 4 Block.png Tutorial 4 Front.png.

13. Change the r1, r2, c1, c2 and then click Run button to get a range of worksheet from Origin to Labview.