
Inconsistent type for a wave reference - complex wave and extract statement

Henry S.
I'm working with complex waves. Depending on conditions, I'd like to either simply define complex wave cw or extract it from another complex wave. Here's a simplified example:
function freewavecollision(a) variable a switch (a) case 1: make/free/c/n=1 wc = { cmplx(1,1) } break default: make/free/c/n=3 longwc = { cmplx(0,0), cmplx(5,5), cmplx (10,10) } extract/free longwc, wc, p==1 endswitch print wc end
When I try to compile this code, I get a dialog box with "Inconsistent type for a wave reference". When I dismiss the dialog box,
wc
in extract/free longwc, wc, p==1
is highlighted. I've tried adding /c/o
to the extract statement to no avail. I also tried this with real numbers and wc is assigned successfully.I've coded in a work-around, but would like to get the logic above to work.
I'm using 32-bit Igor 6.3.5.5 in Windows 8.0.
Thank you!
Henry
November 10, 2014 at 08:09 am - Permalink
As you suggested, it's possible to work around the compiler error by not using
extract
and redimensioning the output wave (wc) as necessary. Instead, I used a couple of temporary waves:I do believe that the compiler is flagging my original code erroneously. If the equivalent is done with real numbers, it works as expected. If you really want to see something weird, while I was testing the behavior with real numbers, I accidentally mixed real and complex outputs for wave w. The code compiles and behaves as I would expect:
The results:
Thanks again for your suggestion. I do appreciate the helpful spirit of this community!
November 20, 2014 at 08:57 pm - Permalink
November 21, 2014 at 12:45 am - Permalink
At least I would have guessed that
complains that b already exists. Or why is there a /O flag if it always overwrites?
November 21, 2014 at 04:31 am - Permalink
As it happens (but incorrectly documented) the overwrite pertains to the destination overwriting the source (i.e., Extract a,a,1). I'll create a ticket to have the docs changed.
Larry Hutchinson
WaveMetrics
support@WaveMetrics.com
November 21, 2014 at 10:21 am - Permalink
The OPs question still remains unsolved for me though.
November 24, 2014 at 02:14 pm - Permalink
When working with complex waves it is useful to remember that MatrixOP provides additional flexibility in that it is not fussy about complex vs real waves. In this case I'd replace the OP line:
with:
A.G.
WaveMetrics, Inc.
November 24, 2014 at 05:36 pm - Permalink
Looking back at the Extract code, I see that there is no support for a complex destination wave reference variable.
I'll look into fixing that.
At present you would have to cheat a bit. Nasty but this works:
Larry Hutchinson
WaveMetrics
support@WaveMetrics.com
November 25, 2014 at 02:48 pm - Permalink
November 26, 2014 at 02:41 pm - Permalink
This fix will be in the next overnight build. You can get that here
http://www.wavemetrics.net/Downloads/latest/
The current build date is Wed, 26 Nov, so anything after that will have the change.
Larry Hutchinson
WaveMetrics
support@WaveMetrics.com
November 27, 2014 at 07:54 am - Permalink
December 2, 2014 at 12:01 pm - Permalink