12-29-2015 02:45 AM
hi,
have string array with date fomat.i want know about index of the date. for example this date index position is varing every 1hour. how can i know about where every hour the date format index in array.
12-29-2015 07:55 AM - edited 12-29-2015 07:55 AM
Use a loop and Scan From String to find your data point.
If you were using LabVIEW 8.6 or newer, this would be a lot simpler by using a FOR loop with the conditional terminal.
12-29-2015 10:55 PM
hi,
it k but my array size is big.so it will take more time to do this.so tell me any other way.
12-29-2015 11:11 PM
hi,
i am using Labview8.2 only.
12-30-2015 06:30 AM
GokulGKM wrote: it k but my array size is big.so it will take more time to do this.so tell me any other way.
You will have to do some parsing of the string inside of a loop. The alternative to using the Scan From String would be to use the Match Regular Expression. I'm not sure it would be any faster without doing some benchmarking.
12-30-2015 07:01 AM
You have told us very little about the Problem, except that (a) it may involve an array of strings, one or more of whose entries may include a date in some unspecified format, and (b) your array is "big" (whatever that means) and you are concerned about speed (but, again, we have no context in which to judge what you mean). Another question is whether the Array is fixed, is varying during the course of the program (that is, whether more entries are being added), whether there is a single Date in the Array or multiple Dates, and whether we are talking about processing files of string arrays.
Consider the following scenario -- I give you a large array of Strings, and say "There may be a String having a Date somewhere within it inside this Array. Find the first such string, or tell me there is none in the Array". Even if we weaken this by changing the condition to "There is at least one such String in the Array", the Worst Case Scenario is that you need to examine every entry in the Array. In the case of exactly one such String, you'd need to examine, on average, half the Array entries. Both of these cases scale linearly with the size of the Array, putting a lower bound on the speed of the search.
So, can you specify more clearly exactly what it is you are trying to do, exactly what is the format of the Array entries, whether or not there are any patterns in how the String entries are placed, any indication about Array Size, etc.? Otherwise, Crossrulz is almost certainly correct that you basically need to parse every entry, and, for an efficient parse, you really need to know the exact format of the Array entry for which you are searching (it is much faster to search for a string that you know starts at Index 0 than for a sub-string that can start "anywhere in this string").
Bob Schor
12-31-2015 01:37 AM
thanks your detaily analysis my proble.
a).i get string array from data base
b).inside array data is unspecified format
c).i know size of array indication
12-31-2015 05:11 AM
i used same condition using sub vi methode.my loop run only one time.wthout sub vi it will work correct here i attached my program.
12-31-2015 10:00 AM
@GokulGKM wrote:
i used same condition using sub vi methode.my loop run only one time.wthout sub vi it will work correct here i attached my program.
I'm confused. Do you still have an issue? Your code seems to run fine for me.
01-01-2016 11:50 AM
some time while loop stop iteraton 1'st time but that time the value is numaric(7 0r 😎 only not date fomat. than i got the following date 07-01-1600 00:00:00 fixed tcontinously.