#pragma rtGlobals=1 // Use modern global access method. Menu "Macros" "Load TTI Data v2", LoadTTI() End Function GetV(theStr) string theStr string regEx = "=[ ]*(.*)", vStr SplitString/E=(regEx) theStr, vStr return str2num(vStr) end Function LoadTTI() String columnInfoStr = "" columnInfoStr += "C=1,F=8,T=4,W=16,N=Date_Points;" columnInfoStr += "C=1,F=0,T=4,W=16,N=Time_sec;" columnInfoStr += "C=1,F=0,T=4,W=16,N=Lifetime_usec;" columnInfoStr += "C=1,N='_skip_';" columnInfoStr += "C=1,F=0,T=4,W=16,N=Phase_deg;" columnInfoStr += "C=1,F=0,T=4,W=16,N=Temperature_C;" columnInfoStr += "C=1,F=0,T=4,W=16,N=Signal_Amplitude;" columnInfoStr += "C=13,N='_skip_';" columnInfoStr += "C=1,F=-2,T=4,W=16,N=APD_Voltage;" columnInfoStr += "C=5,N='_skip_';" LoadWave/B=columnInfoStr/O/Q/A/J/V={","," $",0,0} Wave/T APD_Voltage Make/O/N=(numPnts(Time_sec)) APD_Wave Variable i, APD_Value, Last_APD For(i=0;i<=NumPnts(APD_Wave)-1;i+=1) APD_Value = GetV(APD_Voltage[i]) If(NumType(APD_Value) == 0) Last_APD = APD_Value EndIf APD_Wave[i] = Last_APD EndFor DeletePoints 0,2, Date_Points,Time_sec,Lifetime_usec,Phase_deg,Temperature_C;DelayUpdate DeletePoints 0,2, Signal_Amplitude, APD_Wave, APD_Voltage; DelayUpdate DeletePoints 0,2, Signal_Amplitude, APD_Voltage; DelayUpdate KillWaves APD_Voltage Wave Date_Points,Lifetime_usec,Temperature_C,Phase_deg,Signal_Amplitude,Time_sec Edit Date_Points,Lifetime_usec,Temperature_C,Phase_deg,Signal_Amplitude, APD_Wave,Time_sec Rename Date_Points, 'Date Points'; DelayUpdate Rename Time_sec, 'Time (sec)'; DelayUpdate Rename Lifetime_usec, 'Lifetime (µsec)'; DelayUpdate Rename Phase_deg, 'Phase deg'; DelayUpdate Rename Temperature_C, 'Temperature (°C)'; DelayUpdate Rename Signal_Amplitude, 'Signal Amplitude'; DelayUpdate Rename APD_Wave, 'APD Voltage'; DelayUpdate ModifyTable format('Date Points')=8 End