alukindo Posted September 5, 2010 Report Share Posted September 5, 2010 Hello Lava: Can anyone care to provide a fast method to scan the Date & Time string in column # 3 in the attached VI into a 1-D array of LabVIEW Date & Time data type? I have several methods to do this but I think that there must be a much faster one out there. Thanks in Advance Anthony L Data Array.vi Quote Link to comment
alukindo Posted September 5, 2010 Author Report Share Posted September 5, 2010 Ooops! I forgot to save array data as default and is hence empty. I am including same VI with the data intact Anthony Data Array.vi Anthony Quote Link to comment
jgcode Posted September 5, 2010 Report Share Posted September 5, 2010 Can anyone care to provide a fast method to scan the Date & Time string in column # 3 in the attached VI into a 1-D array of LabVIEW Date & Time data type? I have several methods to do this but I think that there must be a much faster one out there. Maybe it would be helpful for you to post up your methods (that you mention above) too? Quick question: How important is performance to your use case? (given, that you have already have an implementation(s) to parse the data and solve the problem?) Quote Link to comment
alukindo Posted September 5, 2010 Author Report Share Posted September 5, 2010 Hi: I am passing the array into a for Loop and then parsing the 3rd element to get the 3 characters for month #, I then convert the date and time into LabVIEW time. Performance is really important because the array I work with has 50,000+ element. The sad thing is that this data is read from a text file in < than 2 seconds and thereafter a large chunk of time is used to convert that date string column into a calender number that can be computed. Regards Anthony L. Quote Link to comment
Ton Plomp Posted September 5, 2010 Report Share Posted September 5, 2010 Hi: I am passing the array into a for Loop and then parsing the 3rd element to get the 3 characters for month #, I then convert the date and time into LabVIEW time. Performance is really important because the array I work with has 50,000+ element. The sad thing is that this data is read from a text file in < than 2 seconds and thereafter a large chunk of time is used to convert that date string column into a calender number that can be computed. Regards Anthony L. You can use scan from string to get your data as a timestamp. Ton Quote Link to comment
alukindo Posted September 5, 2010 Author Report Share Posted September 5, 2010 Yes, I thought about that, but how about when the abbrev for month name changes from say Jul to a Aug? Or perhaps are you suggesting catching the scan error and incrementing the month name until no error is encountered? Regards Anthony Quote Link to comment
Ton Plomp Posted September 5, 2010 Report Share Posted September 5, 2010 Yes, I thought about that, but how about when the abbrev for month name changes from say Jul to a Aug? Or perhaps are you suggesting catching the scan error and incrementing the month name until no error is encountered? Regards Anthony Here's the formatter for the time format. %b will match the abbreviated month name, this string is locale dependent on dutch system May isn't recognized but Mei is. So if your locale settings is different than the file format you will have a problem. Another option is to replace every month string with a number (Jan -> 1) EDIT: the following code will get the date: %<%d%b%y>T expand it to get the time as well. Ton Quote Link to comment
alukindo Posted September 5, 2010 Author Report Share Posted September 5, 2010 Hi: Attached is how the parsing is done now. Still looking for more efficient alternative. Scan Data String.vi Regards Anthony L. Quote Link to comment
alukindo Posted September 5, 2010 Author Report Share Posted September 5, 2010 Ton P Your format date message arrived after I had posted the above example showing how parsing is done now. I could not figure out a way to scan using your date specifiers. Any help will be greatly appreciated Thanks Anthony L. Quote Link to comment
Ton Plomp Posted September 5, 2010 Report Share Posted September 5, 2010 Ton P Your format date message arrived after I had posted the above example showing how parsing is done now. I could not figure out a way to scan using your date specifiers. Any help will be greatly appreciated Add a '%d - ' before the previous format string, to get two outputs: one with the number, and one with the timestamp. Ton Quote Link to comment
MikaelH Posted September 6, 2010 Report Share Posted September 6, 2010 Do you know that you can do this: Cheers, Mikael 1 Quote Link to comment
alukindo Posted September 6, 2010 Author Report Share Posted September 6, 2010 Mikael: Thanks! That worked Anthony L. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.