 Chris_Co
		
			Chris_Co
		
		
		
		
		
		
		
		
	
			11-02-2006 10:04 PM
ccyang,
nobody has mentioned an alternative to the threshold detect is the threshold peak detector found in full version 8.0.  Perhaps i am timing the VI wrong but i am not getting even 1 millisecond time for 10 million comparisons using this method. I am assuming the array is built otherwise so the comparison time is total time minus loop time. If i am timing the VI wrong- how embarrasing to be seen by the giants like ben, aldenbauch and kevin price. 
  
Kevin, That was the best posting I have read. Most of us would have just not reported on results that did not prove thier opinoin. It inspired me to take the chance to post this amongst giants.
Chris
 GerdW
		
			GerdW
		
		
		 
		
		
		
		
		
	
			11-03-2006 03:03 AM
 Kevin_Price
		
			Kevin_Price
		
		
		
		
		
		
		
		
	
			11-03-2006 07:17 AM
 
   I'll attach it here for what it's worth.
  I'll attach it here for what it's worth. Chris_Co
		
			Chris_Co
		
		
		
		
		
		
		
		
	
			11-03-2006 08:13 AM
 Kevin_Price
		
			Kevin_Price
		
		
		
		
		
		
		
		
	
			11-03-2006 09:08 AM
What'd likely be even better was if NI added options to functions like "Search 1D array", "Threshold 1D Array", etc. that allowed one to specify searching backwards starting from the last element. The default unwired settings would still mean search forward from index 0 so as not to affect existing code.
The explicit call to "Reverse 1D Array" isn't a big deal in block diagram space, but it sure seems wasteful of CPU and memory to have to copy all the elements over just to use those built-in functions. I'd guess NI's source code just traverses arrays by incrementing a pointer. It couldn't be much work to add the option of decrementing the pointer instead, eh?
-Kevin P.
11-03-2006 09:37 AM
 Kevin_Price
		
			Kevin_Price
		
		
		
		
		
		
		
		
	
			11-03-2006 10:31 AM
It IS important to note, however, that FOR loops in LabVIEW are typically much, MUCH faster than in Matlab, at least they were last time I was checking things out a few years back. In the Matlab environment, a m-file with a FOR loop would run in an interpreted mode whereas LabVIEW always runs in compiled mode. It's drastically overly pessimistic to anticipate that LabVIEW FOR loops would slow down execution as much as and interpreted m-file FOR loop. Remember, the LabVIEW examples posted in this thread handle arrays of 1 million elements and still beat the 100 msec time limit you targeted.
Matlab's "vectorized" functions *do* give you nice notational elegance, and quite possibly some speed/efficiency gains over LabVIEW. I've also liked the way its functions can act column-wise on a 2D array, producing a 1D row vector output. You can accomplish the equivalent in LabVIEW, but you'd probably want the original 2D array to have its rows and columns transposed so it can perform its operations row-wise.
My own evaluation has come out like this: I've found I could do all my near-real-time data processing fast enough in LabVIEW that it didn't seem worth the bother of trying to send the data across from one environment to the other so that I could process with Matlab instead. On a few occasions however, I've used Matlab for some post-processing long after the data was stored.
-Kevin P.
 Chris_Co
		
			Chris_Co
		
		
		
		
		
		
		
		
	
			11-03-2006 11:15 AM
Here is the fixed program in 8.0 version. You will not be able to use this program if you have labview base!!
Chris
11-07-2006 07:16 AM