LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to search date format in array

 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.  

0 Kudos
Message 1 of 15
(3,881 Views)

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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 15
(3,847 Views)

hi,

        it k but my array size is big.so it will take more time to do this.so tell me any other way.

0 Kudos
Message 3 of 15
(3,807 Views)

hi,

       i am using Labview8.2 only.

0 Kudos
Message 4 of 15
(3,799 Views)

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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 15
(3,776 Views)

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

0 Kudos
Message 6 of 15
(3,768 Views)

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

                                                              

0 Kudos
Message 7 of 15
(3,728 Views)

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.

Download All
0 Kudos
Message 8 of 15
(3,708 Views)

@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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 9 of 15
(3,690 Views)

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.

0 Kudos
Message 10 of 15
(3,658 Views)