initiating multi-dimensional waves with zero rows

For data management, it seems nice to create an empty wave to hold data and then add points as the data is created:

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


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?
I don't understand what you mean when you say

unfortunately, IGOR doesnt seem to recognize the second dimension unless there is at least one row (sigh, whats the point?)


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:

Function test()
    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?
When I ran the code, it forgets that the wave is two dimensional and only creates one column. All subsequent data entries into [nonexisting] columns cause errors.

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..

daggaz wrote:
When I ran the code, it forgets that the wave is two dimensional and only creates one column. All subsequent data entries into [nonexisting] columns cause errors.


You ran the exact function I posted and got those results?

What version of Igor are you using and what OS?
I ran my own function (which is not complicated and does essentially the exact same thing), as well as just creating a n=(0,3) wave in the command line and then using insertpoints 0,1,that_wave in the command line. in both cases, editing the output wave shows that it is one dimensional and not two.

I am using the almost very latest (there was an update today i have yet to install) version on an windows XP computer.
Ok except your code works fine. That is wierd, I am sure I am doing something stupid, now. Sorry for the bother.
daggaz wrote:
I ran my own function (which is not complicated and does essentially the exact same thing), as well as just creating a n=(0,3) wave in the command line and then using insertpoints 0,1,that_wave in the command line. in both cases, editing the output wave shows that it is one dimensional and not two.

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.