问题
Here is what I did, anyone have a better way of doing it?

Do they have built-in function to do this? I just started using LabVIEW might have overlooked. Like in MATLAB its just:
x = (0:10-1)
and in Python:
x = range(10)
回答1:
The easiest way to create a range, is to do as you've done - but wire the indexing terminal directly and dropping the shift register. There is no built-in way to do this. The only potential gain of that would be to use slightly less space on the diagram.
Edit: As Yair pointed out, there is a built-in way to do this in the form of the ramp pattern. That VI has much more configurability, for example choosing between divide range into N samples or by delta. It does require the full development license however (in the signal processing palette).

回答2:
oysstu's solution is certainly good, and it's what I do in the rare cases where I actually need data like this. Another option is the ramp pattern VI which hides somewhere in the palettes and allows some more complex ranges.
来源:https://stackoverflow.com/questions/30932089/is-there-a-better-way-to-create-a-1d-array-with-n-number-of-elements-in-labview