|
|||||||||||||
02-27-2012 07:28 PM
I've been using data logging for our test fixtures in .tsv files, but our engineers want to automate it further by organizing some new data into several sheets, so I'm looking into manipulating Excel directly using ActiveX.
My question is how efficient is it to write this in ActiveX compared to just making a text file? I'm concerned that, since we're going to be writing some 50000 cells or something, that it'll suck up a lot of memory to do it through ActiveX.
Is this a legitimate concern, or am I just being paranoid?
02-27-2012 08:52 PM
02-27-2012 09:09 PM
will.nevis wrote:
I've been using data logging for our test fixtures in .tsv files, but our engineers want to automate it further by organizing some new data into several sheets, so I'm looking into manipulating Excel directly using ActiveX.
My question is how efficient is it to write this in ActiveX compared to just making a text file? I'm concerned that, since we're going to be writing some 50000 cells or something, that it'll suck up a lot of memory to do it through ActiveX.
Is this a legitimate concern, or am I just being paranoid?
Writing to a text file means you won't be able to have worksheets in an Excel file.
I found with using ActiveX in Visual Basic 6 to write to an actual Excel file, and not just a text *.csv, that there is a time penalty if you don't know how to do the write properly. You need to use arrays and write to a a range in Excel in one shot so to speak. The same most likely applies to LabVIEW as well.
I don't have the code with me at home, but if you are interested, I can look for the actual command when I am at work tomorrow.
02-28-2012 02:02 AM
I have a performance critical system, and the way round a major impact on performance (as far as I can tell ) I have used is a producer/consumer to have the system continuously sample, read values back at a regular rate (e.g. 50ms but obviously depends on your application) and stream them into a TDMS file. This is in excel format. Once testing is complete or your passed the performance critical phase the excel can be processed into whatever format your engineers would like.
Hope it helps
TD
02-28-2012 12:32 PM
Thanks for all the help, guys!
A couple of things -- first off, I'd love to look at that code if you get a chance. But what I'm concerned about is if I create an array of 50000 values or something like that and write it all in one go at the end of the program, two things are going to happen: 1) it's going to take a really long time to finish the program, and 2) if the program crashes in that final step, I'll lose all the data. That second reason is why I currently write a line every cycle to the .tsv file.
What I'm thinking of doing, is meeting you halfway -- rather than write each cell individually, write each line individually within the spreadsheet. This should reduce the memory used (hopefully) and increase performance.
I haven't really played around with TDMS yet, I'll look into it. A couple questions on that -- does it write in excel format? The reason I ask is the second sheet that I'm supposed to add is not going to contain any changing data -- it's just to store some constants that are set on the front panel. If TDMS stores data in excel format, I can write it to TDMS, transfer to Excel, and then use ActiveX to add the second worksheet with the constants at the end of the program. How's that sound?
Thanks again!
02-28-2012 12:38 PM
will.nevis wrote:
...
I haven't really played around with TDMS yet, I'll look into it. A couple questions on that -- does it write in excel format? The reason I ask is the second sheet that I'm supposed to add is not going to contain any changing data -- it's just to store some constants that are set on the front panel. If TDMS stores data in excel format, I can write it to TDMS, transfer to Excel, and then use ActiveX to add the second worksheet with the constants at the end of the program. How's that sound?
Thanks again!
I'll also confirm the speed of writing Excel via ActiveX sucks. It one of the few times I actull put up a message telling user this could take a long time.
There is a plug-in that allow Excel to read TDMS.
Your proposed approach sounds good to me.
Ben
02-28-2012 12:46 PM
You should implement 'Excel VBA Macro' for your data analyzing & call them from LabVIEW.
Which will more efficient rather then calling excel with activeX objects.
http://msdn.microsoft.com/en-us/library/aa220713%2
02-28-2012 12:57 PM
will.nevis wrote:A couple of things -- first off, I'd love to look at that code if you get a chance.
I cut the Excel write time by using xlWorksheet.Range(strCell1, strCell2).Value = fValues in VB6 where fValues is a one-dimensional array, but it should be possible to be modified to be a 2-dimensional array.
My Profile | Privacy |
Legal |
Contact NI
© 2011 National Instruments Corporation. All rights reserved. | E-Mail this Page
|
||

E-Mail this Page