Extract Error
hegedus
I am trying to do some simple data clean up but I am getting a compile error.
I am getting this error on the first extract line and I have looked at other examples and it seems like the syntax is correct, but obviously something is amiss. Error = Inconsistent type for a wave reference and it highlights the second instance of File_Name
Function LoadQEData()
LoadWave/A/O/J/D/W/K=0/B="N=Count;N=File_Name;N=Material_ID;N=Electric_Field;"
//Check for missing data in Count
Wave Count,Electric_Field
Wave/T File_Name
Wave/T Material_ID
Extract/O File_Name, File_Name, numtype(Count)==0 //getting error here
Extract/O Material_ID, Material_ID, numtype(Count)==0
Extract/O Electric_Field, Electric_Field, numtype(Count)==0
//Check for missing data in Electric_Field
Extract/O File_Name, File_Name, numtype(Electric_Field)==0
Extract/O Material_ID, Material_ID, numtype(Electric_Field)==0
Extract/O Count, Count, numtype(Electric_Field)==0
End
LoadWave/A/O/J/D/W/K=0/B="N=Count;N=File_Name;N=Material_ID;N=Electric_Field;"
//Check for missing data in Count
Wave Count,Electric_Field
Wave/T File_Name
Wave/T Material_ID
Extract/O File_Name, File_Name, numtype(Count)==0 //getting error here
Extract/O Material_ID, Material_ID, numtype(Count)==0
Extract/O Electric_Field, Electric_Field, numtype(Count)==0
//Check for missing data in Electric_Field
Extract/O File_Name, File_Name, numtype(Electric_Field)==0
Extract/O Material_ID, Material_ID, numtype(Electric_Field)==0
Extract/O Count, Count, numtype(Electric_Field)==0
End
What is the error in my ways?
Andy
The expression itself should work (as you say) because this gives the right result:
make/o/n=3/t ttt={"a","b","c"}
extract/o ttt,ttt,numtype(aaa)==0
print ttt
January 7, 2018 at 12:47 pm - Permalink
Make/O/T/N=10 TestWave = "Row " + num2istr(p)
WAVE/T TestWave // This is redundant because Make creates an automatic wave reference in this case
Extract/O/T TestWave, TestWave, (p&1) == 0
End
Extract creates an automatic wave reference, like Make, and the /T flag causes it to create a WAVE/T wave reference.
Execute this for details:
DisplayHelpTopic "Automatic Creation of WAVE, NVAR and SVAR References"
January 7, 2018 at 02:22 pm - Permalink
That you for the clarification. Though as an avid reader of the manual, I think the manual could be more clear.
From Manual:
Extract also can use various type flags in user functions to specify the type of destination wave reference variables. These type flags do not need to be used except when it is necessary to match another wave reference variable of the same name or to tell Igor what kind of expression to compile for a wave assignment. See WAVE Reference Types and WAVE Reference Type Flags for a complete list of type flags and further details.
Details
srcWave may be of any type including text.
destWave has the same type as srcWave, but it is always one dimensional. With /INDX, the destWave type is set to unsigned 32-bit integer and the values represent a linear index into srcWave regardless of its dimensionality.
Andy
January 7, 2018 at 03:38 pm - Permalink