When is a (1 column) wave not a (1D) wave?
Fri, 02/01/2019 - 06:42 am
I have some code that creates a one-column, as opposed to one-dimensional, text wave. Redimension /N=(42,1) foo is not the same as Redimension /N=(42) foo. As far as I can make out, I did this so that I could add a dimension label for the column (which can be used as a column label in a listbox). The code stopped working, and I tracked down the problem to wave referencing: changing foo to foo fixed the problem.
I checked this from the command line: print foo gave an indexing error, print foo is allowed. foo gives an empty string rather than an indexing error in a function.
Out of curiosity I closed the edited procedure file and opened the original that referenced the single column wave with just a row number, and magically it works again. Now, from the command line I can execute print foo and the contents of the foo is printed. In both cases dimsize(foo,1) returns 1.
Does this mean that Igor is inconsistently fussy about indexing of 2D waves, allowing me to get away with bad code, or is there something that I'm missing that could be different about these waves? I've simplified the code a bit in the description above, in particular the one-column text wave is overwritten by duplicating the output from ListToTextWave, followed by redimensioning to one column, so it's conceivable that something else is causing the seemingly inconsistent behaviour.
Can anyone shed some light on this?
OS:Macintosh OS X
This is perhaps peripherally related to another question that I posted a while ago: