LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sample elements from randomGen, case structure do Nothing if false, while loop skips iterations, cannot get values from array outside case structure

Solved!
Go to solution

Hello!

 

I tried to build a trigger that fires a True value every 1000 miliseconds(starting from the first True );

that True commands the case structure to sample a value from the randomNrGen and place it in an array;

but I would like to USE that array and I cannot do that beacause I cannot get it out of the case structure.

AND:

the while loop skips samples; if you run the vi and look at the rate at which the array is filling, ypu notice it is not periodical: the first few elements are inserted at 1 second intervals but then it skips one;

could it be because of the 1ms waiting time? 

 

1-How can I create a structure that does this:

IF it receives True, it samples a value from the random Gen. and puts it in the array 

ELSE it does NOTHING, no zeros sent out to the array just wait for the next True and only the values sampled at True remain in the array?

2-How can I prevent it from skipping samples (multiples of 1000 in my case)?

 

In conclusion: I need to be able to take the samples out of the sample generator and store them in a  3d array in a zig-zag manner (1.jpg) but to even think about that, we need to get past the two issues stated above.

Please ignore the counter.

 

Please help me!

 

Download All
0 Kudos
Message 1 of 7
(3,490 Views)

Hi TibiG,

 

I attach a VI that does what you're asking.

 

Good luck.

 

 

Sabri JATLAOUI - Certified LabVIEW Architect - Certified LabVIEW Developer
0 Kudos
Message 2 of 7
(3,471 Views)

1.  Instead of a feedback node, use a shift register.

2. Use the Elasped Time VI.  It does all of the timing counting work for you.  You will still want the Wait (ms) in there though.


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 3 of 7
(3,464 Views)

Thank you for the quick reply !

I was unable to open your vi because I have LabView 2012 and it is 2014 (vi version 14.0 newer than labview version 12.0).

Is there a way to open it in LV2012 ?

0 Kudos
Message 4 of 7
(3,455 Views)

Thank you, Crossrulz!

This does not skip any values and it works fine.

Is there a way to get information out of case without making use of the big while loop ?

My program is going to become very complex (I need to synchronize a magnetometer and a stepper motor to make a 3d map of a magnet's magnetic field) and I want to do everything as simple as possible so,

if there is a way to get information out of a case structure, other tnan by using shift registers on the big while loop, and you know  it, please show me.

Thank you!

0 Kudos
Message 5 of 7
(3,429 Views)
Solution
Accepted by TibiG

@TibiG wrote:

Thank you, Crossrulz!

This does not skip any values and it works fine.

Is there a way to get information out of case without making use of the big while loop ?

My program is going to become very complex (I need to synchronize a magnetometer and a stepper motor to make a 3d map of a magnet's magnetic field) and I want to do everything as simple as possible so,

if there is a way to get information out of a case structure, other tnan by using shift registers on the big while loop, and you know  it, please show me.

Thank you!


You could also use a Feedback Node, just keep it ouside of the case structure.


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 6 of 7
(3,418 Views)

a refference to cop movies comes to mind : "God damn it!"  it was that simple.

Good thing I didn't lose half a day with this :).

Thank you very much, crossrulz !

 

0 Kudos
Message 7 of 7
(3,397 Views)