LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

data missing question, when I tried to insert data to array

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

 

 

0 Kudos
Message 1 of 6
(2,516 Views)

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.

0 Kudos
Message 2 of 6
(2,509 Views)

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.Example_VI_BD.png

 

Thanks and regards,

srikrishnaNF

 

Regards,
Srikrishna


0 Kudos
Message 3 of 6
(2,495 Views)

 


@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!)

0 Kudos
Message 4 of 6
(2,487 Views)

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

0 Kudos
Message 5 of 6
(2,459 Views)

Hi,

see the code

 

replace.png

0 Kudos
Message 6 of 6
(2,438 Views)