LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

excel headings

Hey! Im writing a large amount of current and voltage values into two seperate columns in excel. I would like to write some headings and data meanings into column three and four so I can still graph this data by just selecting the column A & B in excel. Please recommend the best way to do this?
For example:
A                   B                          C                                         D
0.015(mV)    33456(nA)           Cyclic voltammetry             Gold electrode
0.030            33689 
0.045            33999
    .                    .
    .                    .
Thanks in advance,
ken
 
 
0 Kudos
Message 1 of 8
(3,311 Views)
You are using the "Write to Spreadsheet File", so this isn't actually writing an Excel file. It's writing a file that Excel can read since it's tab-delimited with EOL separating rows. That said, the "Write to Spreadsheet File" is polymorphic, so one way is  to select the "String" version and create your 2D array of data as a 2D array of strings. In other words, convert your 2D array of data to a 2D array of strings, append your string columns, and then write out the whole array. As long as you don't have too much data, there shouldn't be a big impact regarding speed and memory usage.

Tip: You can use a file path control rather than a string control and then converting the string to a path.
0 Kudos
Message 2 of 8
(3,295 Views)
Sorry, i'm new to this type of programming. I need to bring my 2D array of values into an "array to spreadsheet string" block and then append the headings to this. Whats the best function block to append these headings before sending them to the "write to spreadsheet file".
This is the final step in a large program and I really appreciate your help.
Thanks,
ken
0 Kudos
Message 3 of 8
(3,290 Views)
You can just use the standard numeric to string functions like so:


Notes:
  • Since you were using two different datatypes I used two different numeric to string functions.
  • You will probably want to set those rings to have "Values match Items".
  • There are other ways of doing this. This is a simple method if you don't have a lot of data.
Tip: Your sample data didn't seem to indicate that you would actually need 64-bit integers, so you can save yourself some memory and just use "regular" I32.

Message Edited by smercurio_fc on 05-21-2007 11:18 AM

0 Kudos
Message 4 of 8
(3,283 Views)
The appended array data from the build array function is not connecting into the write to spreadsheet block. Im not sure why this is occuring. Could you please send on the vi and I can figure this out myself.
Thank you ever so much!
ken
0 Kudos
Message 5 of 8
(3,256 Views)
At first I was scratching my head trying to figure out why you could wire that connection, and then I saw what the problem is... I hadn't realized you were using LabVIEW 8.0. In LabVIEW 8.0 the "Write to Spreadsheet File" is not polymorphic. In LabVIEW 8.20 it is, so you can wire an array of strings, doubles, or integers. No matter, it's quite easy to make a string version of it. Just open the "Write to Spreadsheet File" VI, save it under a new name somewhere within your project folder, and change the input from an array of numerics to an array of strings. You would need to change the format code that's used internally for the Array to Spreadsheet string to %s. I believe that's all that you would need to do. I don't have LabVIEW 8.0 so I can't verify if there's anything else.

Prior to LabVIEW this was a very common thing to do, and anybody who programmed LabVIEW for a while had a string version of this VI in their project files. It took NI until LabVIEW 8.20 to get the message, but they finally got it. I'm sure I have a copy floating around in an older project folder, but it's best if you do it yourself so that you learn how to do it. If you have problems, let me know and I'll dig it up and upload it for you.

Message Edited by smercurio_fc on 05-22-2007 09:08 AM

0 Kudos
Message 6 of 8
(3,252 Views)

Works perfectly! Thanks for your quick and detailed responses.

Kindest regards,

ken

0 Kudos
Message 7 of 8
(3,235 Views)
Is this data being collected all at once or is it the result of individual measurements taken over time? There is a way to create real excel files from within LV even if you don't have excel installed on your computer. The only trade off is that you have to insert data rows into the spreadsheet one at a time. If you are making individual readings that your code is collecting into arrays, this isn't a problem - you just store each datapoint as its collected. If however you are collecting data that is essentially an array (like the sweep of an oscilloscope) this solution would work but would take a lot longer to execute.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 8 of 8
(3,227 Views)