Long logging time in Excel


Recommended Posts


This is my first post, so i am a newbie.

I have to make a datalogsystem with Labjack 12 and DAQ Factory software. The data that I collected is displayed in Excel 2000. I have to make a datalog of every second and during 24 H.

So I need to have 86400 (1*60*60*24) lines in Excel, but Excel seems not to go this far (max. 65536).

I was thinking of creating at least 2 files for the data, but how can i dom this. For example I want to use the first file at 00.00 H until 12.00 H and then the second file from 12.00 H until 00.00 H. If its possible that I can define the date in it that would be great.

Kind regards

Link to comment
Share on other sites

First, might I recommend using a better analysis tool? My personal favorite is Igor, but its quite expensive. There are lots of others that are quite inexpensive and much better at analysis than Excel.

That said, yes, this is quite easy. Lets assume you have an input channel called MyInput, and a logging set called MyLog.

1) Click on "MyInput" in the workspace under CHANNELS to display the channel view, then click on the event tab.

2) In the event tab put:

logging.mylog.strFileName = "c:\data\mydatafile_" + formatdatetime("%p",systime()) + ".csv"

3) Click apply.

What this will do is set the file name of your logging set every time a new data point comes in. 99% of the time, it won't change it at all, but when noon and midnight roll around, it will change the file name. The formatdatetime() function with %p simply generates AM or PM, which is tacked to your file name.

The problem with this is if you don't start the experiment at exactly midnight. For this reason you might want to instead put:

logging.mylog.strFileName = "c:\data\mydatafile_" + formatdatetime("%y%m%d%p",systime()) + ".csv"

which will add the date to the file name as well, thus creating a new file every 12 hours at noon and midnight. Without that, if you ran from say 3am to 3am, the data from midnight to 3am will end up at the end of the file that had data from 3am to noon, with the data from noon to midnight in a separate file.

Link to comment
Share on other sites

Yes, Access certainly would do it, but you won't be able to log directly to an Access database with DF-Express. This requires DF-Standard. You might be able to import it, but that really gets to be a pain. The idea of using 4 columns isn't bad, but would be difficult in DAQFactory. You wouldn't be able to log in-situ, and instead would have to use an Export set to write the file after the data acquisition is done. This is a bit dangerous since a power failure would mean none of the data would be logged. Once again, my recommendation is that you look for a better analysis tool than Excel.

Link to comment
Share on other sites

Excuse me for the late reaction, but I was on X-mas holiday.

Thanks for all the explinations.

This is a project in wich we would to look if it's worth it to log all the data.

But I have discoverd another function that wil give me the files that i needed: in the "logging set" under "detals" I have switch the "Auto Split Files" function ON then I can under "Data File Size" give the numer of rows in the Excel-file. I have to measure every second so I have 3600 rows.

For a measurement of 24 hours I have 24 files.

Link to comment
Share on other sites

Ronny, another method might be to use DDE to pipe it over to Excel, then run a VBA there that starts sorting the data into the next column when one gets full, or when the column reaches a more convenient limit such as a multiple of 3600. I am no expert on that stuff but have heard that programmers use such tricks for lengthy recordings. With Google you might even be able to find VBA examples.

Happy New Year, Joerg


Link to comment
Share on other sites

Yes you can do that, and I even have some samples that show the VBA script (though not the 3600 limit). I haven't tested them in a while, so you may need to play with it, but it should give you a good start. I should note that DAQFactory release 5.70 through 5.74 has DDE server temporarily disabled. You will have to wait until 5.75 is released, which is likely this first week of January 2008. Once you upgrade, make sure and go enable DDE by going to File - Document settings. Because of the overhead it is not enabled by default.

Excel samples are attached.


Link to comment
Share on other sites

  • 2 months later...

i am logging data of 8 channels at scan frequency 200 hz and i need to make logging file for each hour....as per the labjack help guide i used the following sequence



logging.loggy.strFileName=formatdatetime("C:\Dokumente und Einstellungen\admin\Desktop\new logging\BELT_DATA_%p.tsv",systime())



//prevent hanging


//loop around and update filename


but still the system hangs(i.e the graphs and daqfactory s/w crashes).....but i am able to log data....

how can i see the real time graphs and log data without the system crashing?

thnkx in advance

Link to comment
Share on other sites

a) why is the "while" commented out?

:) why do you use only %p in the log file name? This is Am/Pm. Don't you want %H which is the hour?

c) you actually can just do this if you use %H (plus any others you'd like:)

while (1)
   logging.loggy.strFileName=formatdatetime("C:\Dokumente und Einstellungen\admin\Desktop\newlogging\BELT_DATA_%H.tsv",systime())

This will reset the file name every hour on the hour.

As for why the graphs are slowing, you most likely have something else in your document that is using all the idle processing. I'd have to see the document to help. DAQFactory tries to keep you from writing script that will hang DAQFactory, but its still possible, especially if you inadvertently create an infinite loop without a delay anywherel

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.