opticaldynamics Posted May 13, 2009 Share Posted May 13, 2009 Hello, I have two quick issues with my logging files: 1) I have followed section 5.2 (Batch logging of the Daqfactory - LJ user guide) and I basically have a button that controls logging and a variable value component that shows my file path. I also have an export set (i'm not sure I need this...) When I wish to record data, I click on the file path and enter a file name. However when I start logging and exporting the file name resets to what it is on the export sequence. For example: while(1) logging.DataLog.strFileName = FormatDateTime("C:\Docs and settings\admin\desktop\File1_%y%m%d_%H%M.csv", SysTime()) waituntil(floor(SysTime()/3600)*3600+3600) endwhile SO, when I change the file name to File2 on the popup window, I see it displayed. But when I click export data, it still says File1. Now, obviously I see that in the file name, but how can I get rid of this problem without having to go to the export sequence and changing the name there??? 2) This is related to the export sequence. It currently logs one file for a whole hour on the hour. If I wish to record one big file with 24hrs worth of data do I change the last line of code to: waituntil(floor(SysTime()/3600)*3600+3600*24)???? I can't try it now as I am already logging something with it. Thanks Link to comment Share on other sites More sharing options...
AzeoTech Posted May 13, 2009 Share Posted May 13, 2009 1) you'll need to store the file selected in a variable, and then use that variable in the loop that adds the date to the end. Something like: logging.DataLog.strFileName = fileprefixvar + formatdatetime("_%y%m%d_%H%M.csv",systime()) 2) you should change all the 3600's to 86400 which is the number of seconds in a day. Link to comment Share on other sites More sharing options...
opticaldynamics Posted May 15, 2009 Author Share Posted May 15, 2009 Do I do a global variable? For example I tried global name while(1) logging.DataLog.strFileName = C:\Docs and settings\admin\desktop\name + formatdatetime("_%y%d_%H%M.csv", SysTime()) waituntil(floor(SysTime()/3600)*3600+3600) endwhile Thanks Link to comment Share on other sites More sharing options...
AzeoTech Posted May 15, 2009 Share Posted May 15, 2009 That won't work. You want: global string name = "C:\docs and settings\admin\desktop\myfile" while (1) logging.datalog.strFileName = name + formatdatetime("_%y%d_%H%M.csv", SysTime()) waituntil(floor(SysTime()/3600)*3600+3600) endwhile Then change name from somewhere else as needed. Link to comment Share on other sites More sharing options...
opticaldynamics Posted May 21, 2009 Author Share Posted May 21, 2009 Thanks, it works now. I have another quick question. I average ten data points using channels and log this. On the display, I obviously get a new update every 10 seconds or so. Is there a way to read and show data every second, but log an average of however many points I want or maybe even every 10th point or so? Thanks. Link to comment Share on other sites More sharing options...
AzeoTech Posted May 22, 2009 Share Posted May 22, 2009 Not with a logging set. You'd have to switch and use an export set. Then you could put mean(mychannel[0,9]) in for the expression and have the channel update every second. You'd need to trigger the export set from a sequence though, running every 10 second: while(1) beginexport(myexportset) delay(10) endwhile Link to comment Share on other sites More sharing options...
opticaldynamics Posted July 27, 2009 Author Share Posted July 27, 2009 Hi, Sorry to bother you about the same topic again, but something must have happened to my program because it no longer logs like you showed me. basically, I have a logging set DataLog with a filename: C:\Documents and Settings\administrator\Desktop\FileData\test1_0927_1143.csv I want this file to change test1, to test2 or any other file name I wish. As mentioned on my above post I also have an export set: ExportData global string name = "C:\Documentss and Settings\administrator\Desktop\FileData\filename" while (1) logging.datalog.strFileName = name + formatdatetime("_%y%d_%H%M.csv", SysTime()) waituntil(floor(SysTime()/86400)*86400+86400) endwhile I then created a variable value component called File name with expression name and set to name. I can click on this and change my file name to C:...........test2, but when I click on start logging and my export set the name changes again to test2. Any help would be appreciated again. Thanks Link to comment Share on other sites More sharing options...
AzeoTech Posted July 27, 2009 Share Posted July 27, 2009 Somewhere else you are changing the name. I'd probably need to see your .ctl doc. Also, you might consider using File.FileSaveDialog() to prompt the user for the filename. This opens the standard windows save dialog with the ability to browse the folder structure of the system. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.