LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

start at 100 and subtract 10 filling an array in a for loop?

Solved!
Go to solution

HI i'm having a brain freeze can someone tell me how to fill an array in a for loop so it has 100, 90, 80,         70 etc - this is so simple but i'm having difficulty initialising the array and building it with shift register etc 

0 Kudos
Message 1 of 9
(3,223 Views)

As you stated, store the current value in a shift register.  Inside the loop subtract 10.  Have the results autoindex out as well to build the array.


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 2 of 9
(3,208 Views)

could you post an example? as a VI or screen shot? I could do this in an instant in Python or Matlab  - but i have control of variables very easily and I just can't get my head into Labview!!

0 Kudos
Message 3 of 9
(3,206 Views)
Solution
Accepted by charliejeynes

@charliejeynes wrote:

could you post an example? as a VI or screen shot?


How this reads: Do my homework for me!

 

This is super basic and any example I can come up with will give you the answer.  If you know how to use a shift register and how to autoindex an output array, you can do this.  The wires are the variables, so you have full control over them.


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 4 of 9
(3,195 Views)

"Ramp Pattern" is a polymorphic VI. Select the "Ramp by Delta" flavor.

 

Wire "-10" to the delta "100" to the start, "0" to the end you are done.

 

If you are required to do it the hard way a For loop with a "11" wired to the "n" and then subtract "10" times the iteration terminal from "100" and wire to an output tunnel.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 5 of 9
(3,189 Views)

you may be interested in

"http://zone.ni.com/reference/de-XX/help/371361J-0113/lvanls/ramp_pattern/"

 

EDIT: Ups, Ben was quicker than me

Message 6 of 9
(3,186 Views)

it is super easy when you are familiar with all of labviews peculiarities - 

for anyone interested I did this 

0 Kudos
Message 7 of 9
(3,169 Views)

Are you sure you want the For loop to run 100 times?

0 Kudos
Message 8 of 9
(3,141 Views)

@charliejeynes wrote:

HI i'm having a brain freeze can someone tell me how to fill an array in a for loop so it has 100, 90, 80,         70 etc - this is so simple but i'm having difficulty initialising the array and building it with shift register etc 


The "etc." poorly defines the problem. Do you want stop at zero? At 60? At -1000000??? What do you want the final array output to be?

 

And yes, I would do something similar to what Ben suggested.

 

Subtractortractor.png

Message 9 of 9
(3,120 Views)