Function Test()// make some test dataMake/O/N=10 wData={5,3,4,5,6,2,1,7,0,9}// copy to a 'result' waveDuplicate/O wData,wFilteredData
// use conditional to set certain values to NaN
wFilteredData[] = wFilteredData[p]>5 ? wFilteredData[p] : NaN// remove the NaNsWaveTransform zapNaNs wFilteredData
// display the data in a tableEdit wData,wFilteredData
End
Function Test()// make some test dataMake/O/N=10 wData={5,3,4,5,6,2,1,7,0,9}// extract values > 5Extract wData, wFilteredData, wData >5// display the data in a tableEdit wData,wFilteredData
End
Function Test()// make some test dataMake/O/N=10 wData={5,3,4,5,6,2,1,7,0,9}// extract values > 5Extract wData, wFilteredData, wData >5// display the data in a tableEdit wData,wFilteredData
End
[/quote]
hm, yes, shorter but not necessarily faster…well, at least not on large data sets ;-)
function speed1(w)wave w
variable num = StartmsTimerDuplicate/O w nw
Multithread nw = w >3 ? w : NaNWavetransform zapNaNs nw
printStopmstimer(num)/1e6
endfunction speed2(w)wave w
variable num = StartmsTimerExtract/O w, nw, w >3printStopmstimer(num)/1e6
end
•make/N=1e7 test = enoise(5)
•speed1(test)0.509921
•speed2(test)1.08944
Hope this helps.
February 19, 2014 at 01:48 am - Permalink
An attempt was made to treat a text wave as if it were a numeric wave.
I didn't think I had a text wave... The example with your wData wave works though.
February 19, 2014 at 02:03 am - Permalink
where tWave is your text wave.
February 19, 2014 at 02:12 am - Permalink
"got 'tWave' instead of a string variable or string function name"
nWave = str2num(tWave[p])
February 19, 2014 at 02:30 am - Permalink
February 19, 2014 at 02:51 am - Permalink
February 19, 2014 at 04:25 am - Permalink
--Jim Prouty
Software Engineer, WaveMetrics, Inc.
February 19, 2014 at 11:24 am - Permalink
February 19, 2014 at 11:11 pm - Permalink
[/quote]
hm, yes, shorter but not necessarily faster…well, at least not on large data sets ;-)
February 19, 2014 at 11:17 pm - Permalink