initiating multi-dimensional waves with zero rows
daggaz
make/o/d/n=(0,3) data_wave
for (i = 0; i < cutoff_point ; i +=1)
generate a,b,c,d
insertpoints 0,1,data_wave
data_wave[0][0] = a
data_wave[0][1] = b
data_wave[0][2] = c
data_wave[0][3] = d
endfor
for (i = 0; i < cutoff_point ; i +=1)
generate a,b,c,d
insertpoints 0,1,data_wave
data_wave[0][0] = a
data_wave[0][1] = b
data_wave[0][2] = c
data_wave[0][3] = d
endfor
unfortunately, IGOR doesnt seem to recognize the second dimension unless there is at least one row (sigh, whats the point?)
Is there some clever trick you guys use to get around this, without doing something ugly like starting the first row = 0, and then remembering to always subtract one from the length of the wave for the rest of the code?
Or is that what we do?
If you execute the following function, which is a slightly modified version of the code you originally posted, it executes fine and you get a 10 row wave with data values in all rows and columns:
make/o/d/n=(0,3) data_wave
variable i
variable cutoff_point = 10
variable a, b, c, d
for (i = 0; i < cutoff_point ; i +=1)
a = enoise(1)
b = enoise(2)
c = enoise(3)
d = enoise(4)
insertpoints 0,1,data_wave
data_wave[0][0] = a
data_wave[0][1] = b
data_wave[0][2] = c
data_wave[0][3] = d
endfor
end
What would you expect to happen instead?
June 13, 2013 at 06:03 am - Permalink
I tried this both in a function and in the command line. I found it was necessary to include at least one row in the make command, to overcome this. Unfortunately, this results in an empty row at the end of the wave which throws any indexing off by one if you use the number of points..
June 13, 2013 at 06:09 am - Permalink
You ran the exact function I posted and got those results?
What version of Igor are you using and what OS?
June 13, 2013 at 06:15 am - Permalink
I am using the almost very latest (there was an update today i have yet to install) version on an windows XP computer.
June 13, 2013 at 06:20 am - Permalink
June 13, 2013 at 06:23 am - Permalink
If I recall correctly, the ability to create a 0 row wave with nonzero columns was added after I requested this many years ago. In most respects, Igor treats this kind of wave the same as if it had zero points (technically, it does have zero points), so when you edit it in a table Igor shows it as having 0 points (which means 0 columns).
Likewise, the data browser shows it as having 0 rows.
June 13, 2013 at 08:19 am - Permalink