LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Switch Excel columns and rows in write to spreadsheet and more

I'm trying to get the output from a machine, output it to a spreadsheet, and potentially have it graph the data in Excel.

My code and the resulting spreadsheet are attached.

 

I want the data to be vertical, with all the data being in Columns A and B as opposed to being in Rows 1 and 2

i also want to add Column titles for Voltage and Current.

If possible, I would also like to be able to graph the data automatically.

 

I am running Labview 7.1.

Thank you

Download All
0 Kudos
Message 1 of 36
(5,259 Views)

Play with the Transpose Input of the Write To Spreadsheet File VI.

Message 2 of 36
(5,241 Views)

Thanks, that switched my rows/columns. 

 

Now I just have to add the column titles and see if its possible to automatically graph the data. 

Any suggestions?

0 Kudos
Message 3 of 36
(5,227 Views)

Use Write Characters to File to write your column labels.  Wire the Path Out from that VI to the Write Spreadsheet file and set Append to true.

 

As for Graphing, someone who actually uses Excel would have to help there.  I would check out the examples or check out this thread for Excel questions (NO POSTING, JUST READING).

 

http://forums.ni.com/t5/BreakPoint/Excel-Board/m-p/379682

 

 

Message 4 of 36
(5,215 Views)

If you were running a newer version of LabVIEW I'd say the following: just call the Write to Spreadsheet File and pass it a 1D array of strings that are your column headers. When writing the actual data with the 2D array make sure you have the "append" set to true.

 

Since you're running LabVIEW 7.1, the Write to Spreadsheet File VI is not polymorphic. So, you have 2 choices:

  1. Make a version that accepts strings. If you open the Write to Spreadsheet File VI and look at the block diagram it contains instructions on how to make a version that accepts a different datatype. Make sure you save this new VI with your files, and not in the LabVIEW vi.lib directory.
  2. Use the standard File I/O functions to write out your columns to the file prior to using the Write to Spreadsheet File VI.

 


If possible, I would also like to be able to graph the data automatically.


Your images shows a graph terminal, so I don't understand this question.

 

Message 5 of 36
(5,213 Views)

This post seems like it would have been helpful, but the code is for Labview 2009, and I only have Labview 7.1

http://forums.ni.com/t5/LabVIEW/Running-a-Excel-macro-from-a-open-workbook/m-p/1023514?jump=true

 

 

I have written a macro for Excel to draw the graph, I just have to be able to have Labview run it after it outputs the data.

I want to output an excel file with all the data and a graph of the data in it.

 

 

 

 

0 Kudos
Message 6 of 36
(5,203 Views)

Oh, and if possible, I'd like Labview to store the macro (not the xls file) so that this is more platform independent, and the user doesn't have to deal with installing the macro

0 Kudos
Message 7 of 36
(5,200 Views)

If you need to work with actual Excel workbooks, then you can't use Write to Spreadsheet File. That creates text files, not Excel workbooks. Excel workbooks are a proprietary format, and you need to use ActiveX to manipulate Excel. There are examples that ship with LabVIEW on how to use ActiveX, including a couple of examples on using it to control Excel. Open the Example Finder (Help -> Find Examples) and search for Excel. Also, as Darin indicated, look at the many links in the Excel thread that point to other examples. As noted, do not post question in that thread.

Message 8 of 36
(5,195 Views)

Thanks, I thought I was hitting a roadblock like that after I ran a macro on a text file I'd renamed as .xls and it asked me to resave in excel format.

I'll try looking through some of the examples and come back here if I need more help.

 

Thanks again

0 Kudos
Message 9 of 36
(5,187 Views)

Alright, I'm having major issues trying to figure out the activex stuff to get it working. Does anyone know of a good activex/labview tutorial? An excel specific one would be amazing.

0 Kudos
Message 10 of 36
(5,167 Views)