Fill all points in a wave with a certain value?
PeterR
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
Make /O /N=5
, is there a way (besides a loop) to assign "nan" or "0" to all points in the wave?
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
June 12, 2014 at 11:40 am - Permalink
June 12, 2014 at 11:45 am - Permalink
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.
June 13, 2014 at 11:34 am - Permalink
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
June 13, 2014 at 11:40 am - Permalink
Yes! It works great. Thanks again!!!
June 13, 2014 at 11:48 am - Permalink
DisplayHelpTopic "Waveform Arithmetic and Assignment"
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
June 16, 2014 at 09:07 am - Permalink
June 18, 2014 at 11:14 pm - Permalink
In reply to by hegedus
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?
June 4, 2020 at 04:18 am - Permalink
In reply to For some reason, when called… by Jakub
Maybe you have defined x as a variable? That would subvert the wave assignment.
June 4, 2020 at 06:20 am - Permalink
In reply to Maybe you have defined x as… by tony
Thank you for pointing out this obvious mistake! :)
June 5, 2020 at 07:19 am - Permalink
Allowing a variable named x was an early mistake in the Igor language that we regret.
June 5, 2020 at 10:24 am - Permalink
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! ;-)
June 5, 2020 at 10:44 am - Permalink