Fill all points in a wave with a certain value?

Is it possible to fill a wave completely with a certain value without using a loop?

For example after performing Make /O /N=5, is there a way (besides a loop) to assign "nan" or "0" to all points in the wave?

Greets,
Peter
johnweeks wrote:
Make/O/N=5 wave0=NaN
Make/O/N=5 wave0=0
DisplayHelpTopic "Waves"
and in particular,
DisplayHelpTopic "Waveform Arithmetic and Assignment"

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com



Hello John

I'm in a similar problem.

I need to make a wave with same number points as the other one, so I use Make/O/N=(numpnts(wave0)) wave1

Now I need all points in the new wave as integers as 1,2,3.....
How could I make it?

Thank you so much.
If your new wave has the default scaling, i.e. start at 0 and delta of 1.

then:

Newwave = x

will populate it with values 0,1,2,3,4.

if you want the first value as 1

Newwave = x+1

gives 1,2,3,4,5
hegedus wrote:
If your new wave has the default scaling, i.e. start at 0 and delta of 1.

then:

Newwave = x

will populate it with values 0,1,2,3,4.

if you want the first value as 1

Newwave = x+1

gives 1,2,3,4,5



Yes! It works great. Thanks again!!!

In reply to by hegedus

hegedus wrote:
If your new wave has the default scaling, i.e. start at 0 and delta of 1.

then:

Newwave = x

will populate it with values 0,1,2,3,4.

if you want the first value as 1

Newwave = x+1

gives 1,2,3,4,5


For some reason, when called inside of the function, this gives me a wave filled with ones (or with twos if x+1 is used) but called from the command window it works ok. What am I missing here? 

Allowing a variable named x was an early mistake in the Igor language that we regret.

Just use Newwave = p+1 for using the point counter instead. Problem solved, unless you have assigned p as a separate variable as well, I guess! ;-)