LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to create ascending 1D array

Solved!
Go to solution

This is something that has bugged me for a little while because I feel like there should be a much easier way to do this but after looking around for a while and not finding anything I figured I would ask. When working with arrays and XY graphs sometimes it is necessary to come up with a straight ascending array of the format [x, x+1, x+2, ..., X +(n-1), X + n] and while I know that this is reasonably straight forward to do with a FOR loop and auto-indexing I feel like there must be a VI somewhere that is able to do this much faster/easier/tidier.

 

Does anyone know of such a VI or have a different method of building these arrays?

0 Kudos
Message 1 of 4
(3,734 Views)
Solution
Accepted by topic author ogk.nz

Ramp Pattern.vi in the Signal Processing palette.

 

Lynn

Message 2 of 4
(3,727 Views)

Thanks.

 

I figured there was something like that but just getting the right terms to think/search for was causing problems. I'm not sure about faster, but it should definitely be tidier/easier.

0 Kudos
Message 3 of 4
(3,716 Views)

@ogk.nz wrote:

When working with arrays and XY graphs sometimes it is necessary to come up with a straight ascending array of the format [x, x+1, x+2, ..., X +(n-1), X + n] and while I know that this is reasonably straight forward to do with a FOR loop and auto-indexing I feel like there must be a VI somewhere that is able to do this much faster/easier/tidier.


Just a related comment: If all plots share the same x-values, it is much simpler to use a waveform graph and define x0 and dx for the x-axis. No ramp needed. (You can do that via property nodes or, even simpler, by bundling).

 

In your case ([x, x+1, x+2, ..., X +(n-1), X + n]) you only need to set x0, because dx remains at 1 (i.e. the default).

 

 

0 Kudos
Message 4 of 4
(3,708 Views)