LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Plotting 1st column vs 2nd column in Excel from LabVIEW

I have an excel file of 2 columns, the rows varies for each execution of the VI. How to do I get Excel to plot them in the order of 1st column(x) vs 2nd column(y).I already have an idea of how to plot column wise value in excel using activeX in LabVIEW. But it works in column wise only.
0 Kudos
Message 1 of 7
(3,586 Views)
You might want to start by looking at the Write Table to XL.vi which ships with LabVIEW. It demonstrates how to write to particular rows and columns using ActiveX for Excel. If you are going to programming much with Excel, I would suggest purchasing the Report Generation Toolkit for Microsoft Office which you can add to LabVIEW. It makes it much easier to build impressive reports with Excel.
J.R. Allen
0 Kudos
Message 2 of 7
(3,586 Views)
If you can create a column-wise chart, you are halfway there. Just make a standard line chart out of the second column only. Then use ActiveX to change the XValues of the first series to the values of the first column.

In Excel:
ActiveChart.Series(1).XValues = Range(A:A).Value

In LabVIEW:
RefChart to Invoke Node->SeriesCollection
Set Index input to 1
Output SeriesCollection Variant to Variant to Data
Wire type to Excel Series
Output to Property Node->XValues
Change to Write
Convert the array of doubles to Variant

Your chart will automatically become an XY Chart.

Michael
http://www.stitchofclass.com
Michael Munroe, CLD, CTD, MCP
Automate 1M+ VI Search, Sort and Edit operations with Property Inspector 5.1, now with a new Interactive Window Manager!
Now supports full project automation using one-click custom macros or CLI.
Message 3 of 7
(3,586 Views)
Hi Michael,
I am not able to clearly follow the steps, could you please attach an example vi.Iam working under ver. 6i.
Thanxs,Selva
0 Kudos
Message 4 of 7
(3,586 Views)
Here you go. These VIs expect you to have an Excel file open with a Worksheet reference. Use the LV example VI if you don't have one.

The three VI's will create a new chart object on the specified sheet, add the source data specifed by the range, then change the XYValues for the first series only.

Michael
Michael Munroe, CLD, CTD, MCP
Automate 1M+ VI Search, Sort and Edit operations with Property Inspector 5.1, now with a new Interactive Window Manager!
Now supports full project automation using one-click custom macros or CLI.
0 Kudos
Message 5 of 7
(3,586 Views)
Hi Michael,
I wired up an Excelsheet reference and it worked clear as an xy chart.It helped out a lot.
Thanxs again
Selva
0 Kudos
Message 6 of 7
(3,586 Views)
If I have a table in Excel and I want it to graph column 1 and column 10, use column 1 as the X data and column 10 as the Y data, how would that be done?
0 Kudos
Message 7 of 7
(3,586 Views)