01-31-2011 09:38 PM
Hi All
I have a simple question about building array.
Like shown in the pic of attachment, I tried to put the data to a 1D array.
But if I set 1ms for "wait(ms)" , which means the sampling rates should be 1K, but actually I just can get around 2600. when I press
start button. (it should be 1000*5 = 5000)
Can anybody help me to fix this issue?
Thanks
01-31-2011 10:07 PM
The function build array isn't recomended in this case. If you want speed you must initialize the array first and the use the function replace array subset.
Other thing is the wait for miliseconds, the resolution os this function depends of the system load, generally the reslution is poor, around 5ms.
02-01-2011 12:56 AM
Hi jiemo,
Instead of build array why dont you use a normal for loop as a build array function in any case is not a memory effiicient one.And you cannot achieve a 1ms resolution in labview using a software timer...Because as software timer is dependant on OS ..You can use a timed while loop also to get almost a proper resolution.I am attaching a screen shot using a timed while loop to have a better understanding.In this one,i created a timed while loop with 1ms period and placed a Elapsed time Vi(configured for 2 sec) and placed a random number generator..Theoritically the size of generated array will be 2000,but here it will be around 1957-2004.
Thanks and regards,
srikrishnaNF
02-01-2011 01:06 AM
@jiemo wrote:
But if I set 1ms for "wait(ms)" , which means the sampling rates should be 1K, but actually I just can get around 2600. when I press start button. (it should be 1000*5 = 5000)
Sorry, I don't understand your math. What is 2600? What should be 5000? What do you actually measure, and how?
What is the mechanical action of your buttons? What is in the other case of the case structure? How long is this supposed to run?
What are you trying to achieve? How big does the array get in the worst case?
(It is always better to attach a VI, instead of a picture. Thanks!)
02-01-2011 10:54 AM
Thanks a lot, Can you give a simple example codes?
How to build array by using initialize and replace array subset
I really want to know how to use such way to build array
02-01-2011 02:01 PM
Hi,
see the code