 charliejeynes
		
			charliejeynes
		
		
		
		
		
		
		
		
	
			12-21-2017 04:38 AM
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
Solved! Go to Solution.
 crossrulz
		
			crossrulz
		
		
		 
		
		
		
		
		
	
			12-21-2017 06:25 AM
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.
12-21-2017 06:38 AM
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!!
 crossrulz
		
			crossrulz
		
		
		 
		
		
		
		
		
	
			12-21-2017 07:43 AM
@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.
 Ben
		
			Ben
		
		
		 
		
		
		
		
		
	
			12-21-2017 07:49 AM - edited 12-21-2017 07:53 AM
"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
 
					
				
		
 alexderjuengere
		
			alexderjuengere
		
		
		
		
		
		
		
		
	
			12-21-2017 07:53 AM - edited 12-21-2017 07:54 AM
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
12-21-2017 08:19 AM
it is super easy when you are familiar with all of labviews peculiarities -
for anyone interested I did this
 arteitle
		
			arteitle
		
		
		
		
		
		
		
		
	
			12-21-2017 01:17 PM
Are you sure you want the For loop to run 100 times?
 altenbach
		
			altenbach
		
		
		 
		
		
		
		
		
	
			12-21-2017 05:01 PM
@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.