LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Replacing the math script code with the for loop/while loop

I have this small pieceofcode ,nowi want to replace this small code of mathscript with for loop/(any other way also if possible)

How should i do

Download All
0 Kudos
Message 1 of 3
(2,345 Views)

It looks like it is creating an array of values from 0 to 1 with a step of .005.  Is that correct?

 

Take a look for the "Ramp Pattern" function.  It will do the same thing.

 

To do it with a loop ...

 

0 Kudos
Message 2 of 3
(2,344 Views)

I agree that the ramp function would be best.

 

If you want to use a loop, Typically a FOR loop is best. With the while loop you might get some surprises due to the limitations of floating point.

 

You should also make yourself more familiar with the basic labview palettes. Your (value times -1) and (zero minus value) can both be replaced by a "negate" function. These operations are commutative, so it is more efficient to negate the multiplier instead of the large array, right?

 

You also need to learn the difference between a graph and a chart. In my opinion, a chart is not the correct choice here. Use a waveform graph. I would also recommend to keep consistent front panel style. Don't randomly mix classic and modern controls.

 

 

0 Kudos
Message 3 of 3
(2,323 Views)