LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

quick question on building an array

Is there any function in labview similar to the linspace fuction in Matlab where one can set a starting point and ending point and the number of entries and an array will be made of the range requested in the number of partitions specified? For example linspace(0,10,2) would make the array [0,10] while linsapce(0,20,5) would make the array [0,5,10,15,20]. Thanks,
Intern NSWCCD Carderock.
0 Kudos
Message 1 of 7
(8,553 Views)
Not directly. The Initialize Array function will create an array of the specified size and fill all elements with the value entered. You could then run through a loop with the Replace Array Element function to change the values. If you expect to do this often, create a subVI with the min, max, and step size as input parameters. It should be fairly straight forward and unless the array is huge, it should be fairly fast.

Lynn
Message 2 of 7
(8,544 Views)
This looked like a fun thing to do so here it is. Use the attached vi as a subvi. Inputs are Start, End, NumElements. Output is an array from Start to End containing the number of elements specified. The numericals are DBL type in case whole numbers don't work out with the input values. I did this quick and dirty. I'm sure there are more elegant solutions, but this will work fine.
- tbob

Inventor of the WORM Global
Message 3 of 7
(8,538 Views)
Thanks a lot for the help!
Intern NSWCCD Carderock.
0 Kudos
Message 4 of 7
(8,526 Views)
There is no need to reinvent the wheel. Look for "Ramp Pattern". 🙂 (Unless you only have LabVIEW base).

Message Edited by altenbach on 06-14-2005 12:19 PM

Message 5 of 7
(8,524 Views)
In LabVIEW, the function is called Ramp Pattern and is on the Analyze>Signal Processing>Signal Generation palette.;)
0 Kudos
Message 6 of 7
(8,519 Views)
Now you went and spoiled my fun... 😞 Too many functions to keep with all of them...
- tbob

Inventor of the WORM Global
Message 7 of 7
(8,499 Views)