LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Writing to Spread Sheet File

Hi,

I would like some assistance with writing some data to a spread sheet file. Everytime I place the icon within the while loop, and run my program, a window pops up and I select a microsoft excel file. after this nothing appears to happen. I'm following instructions from an old out of date LV text book, and may be missing something very simple.

Please could someone tell me this is the case, or advise otherwise.

Within this loop I have various thermocouple and strain gauge transducers, and a power meter.

I understand I need to read from the SS file, and there is an icon to do this, but I thought you could open your marked SS file and read the data directly from it.

Please tell me this is simple to do.
Thanks
0 Kudos
Message 1 of 17
(3,935 Views)
I'm assuming you are collecting one data point every time the while loop executes. If so Labview is doing exactly what you are telling it to do- namely, collect one data point, ask for a filename, and write that one data point to the file.

Maybe you want to write data after some number of points are acquired? Or maybe you want to use Write characters to file.vi, with the optional input set to append to an existing file?
0 Kudos
Message 2 of 17
(3,916 Views)
 
Hi, please have a look at my VI posted below, it includes a power meter, and temperature, and strain gauge transducers.  I've wired the whole thing to loop together.  Should I place these in paralell loops, in order to retrieve different sets of data, or is it possible to write all of this data to the same file? 
 
Ideally, I'd like to get all this data,  and run it continuously over a period of time, and then be able to see the results in a spread sheet file.  Then plot the data against time, each data set relating to the same time, for purposes of comparison.
 
Is my VI far from achieving this?
 
 
0 Kudos
Message 3 of 17
(3,901 Views)

I have finished building the VI above for now, and think I've found all necessary functions to write the data to a spread sheet and read from it.  Still I'm having trouble receiving anything meaningful.  It would be great if someone could have a look at the updated VI's below, and advise me on where to go from here. 

When I created the 'read from spreadsheet' vi, two icons appeared within the save file window.  These were named 'bnry' and 'write.'  Does anyone know if these are of any use? 

Thanks 

Download All
0 Kudos
Message 4 of 17
(3,888 Views)
Hi Damsin

Which version of LabVIEW are you working on? Have you thought about using the Report Generation VIs that are on the Functions palette. The VI that you posted on the last entry doesnt incude any sort of writing to spreadsheet functions.

Like GWD mentioned in the previous post it may be an idea to acquire all the data and then write to the file but this is totally up to you. If you use the correct architecture you will be able to acquire and write data sequentially. Something along the line of a Producer/Consumer architecture maybe something you could implement in your code (information below) There are many shipping examples available with LabVIEW and also the www.ni.com website has very useful example coding.

http://zone.ni.com/devzone/cda/tut/p/id/3023

Kindest Regards

YatinM
0 Kudos
Message 5 of 17
(3,886 Views)
Hi, I'm working on version 7.1. The VI posted below is a long way away from the previous, and I would be really grateful if anyone of you guys could help me with it.

Instead of using Report Generation VIs, one of my colleagues recommended using a Write to Text File VI example from LabView. I've cut and pasted them into my VI, and have'nt a clue what to do with them. No broken wires which is a good sign, and the error box only contains three errors, so I'm not that far from completing it?

Instead of lumping them all together I've seperated them so I'll have three different 3 different sets of readings I've included a Wait For function so my data should come out every second.

Is there an easy way of doing this, seeing my data at long last?

Thanks
0 Kudos
Message 6 of 17
(3,871 Views)

Are you attempting to write to three different files? If so, you've made it pretty confusing because you have the same message for all of the file dialogs. If you are trying to write to a single file, then you can do it much simpler than what you have now. The first thing I would do would be to eliminate all of the dynamic data type conversion and use scalars throughout. Also, what you are doing with the Array to Spreadsheet String and the Write File, can be done with just the Write to Spreadsheet function. You've also got an incorrect format string of %1 and one is missing.

I've never used cFP but isn't there a way to get multiple channels without having an Express VI for each one? If this was a DAQmx task, all channels from a single DAQ board would have a single VI for the acquisition.

And, while it is apparently okay to wire dynamic data to the while loop's conditional terminal, does this actually do anything? What makes the while loop stop?

0 Kudos
Message 7 of 17
(3,862 Views)
Yeah, I want to write to 3 different files because otherwise it would be too confusing if I wrote the data from the meter, and transducers to 1 file. I wouldn't be able to distinguish between what was what I think? Can I still write to three files, using write to spreadsheet function?

I was wondering too how to make the while loop stop. I just usually press the abort button. Is there a function in LabView that allows the loop to automatically stop after a certain period of time? I could use the For Loop, and stipulate a certain amount of iterations.

Any thoughts?
0 Kudos
Message 8 of 17
(3,844 Views)
If the columns were labeled, I don't know why it would be confusing at all. You can write to three different files but it's going to be slower. The problem with the higher level Write to Spreadsheet File is that it opens and closes the file each time it is called. Here is an example that creates a header and writes all data to a single file. It uses the Write File Function instead of the Write to Spreadsheet just to be able to write text as fast as possible. I don't show any dynamic data because you don't need it. A Waveform chart is perfectly happy plotting scalars. I've also shown three different ways to stop a while loop. There's a front panle stop button, a timer, and a comparison to the loop iteration.
0 Kudos
Message 9 of 17
(3,836 Views)
Hi, I've made those changes, and my VI seems to be OK now(no broken arrow). I attached it below, and I'm pretty pleased with it. Thanks. I cant seem to get rid of the dynamic data wire, it automatically leaves the channel in that way, but I've managed to wire single scalars into the array in the while loop. I included the stop button to the condition terminal, continue if true, which should be fine, do you think?

I assume when it prompts you to select a data file to write, you use the default name in the Open/Ceate/Replace file? Will I need to change the default name, each time I want to write new data?

The array going into the Array to spreadsheet string, will they relate directly to the array within the while loop, and will there automatically be a coloumn for the time, or will I need to add a time stamp from the fieldpoint channels?

Since I've never written anything to file before, I was unsure how it worked, but I have a clearer idea now. I'm not in the lab this weekend and am working at home. I wont find out until monday if it will work or not. But I have full faith in it.
0 Kudos
Message 10 of 17
(3,816 Views)