
Help with $ to call a wave

Vivvi87
I am trying to write procedures to fit force curves measured with AFM. I have already wrote 2 functions, one to load the force curves, and the second one to fit and subtract the base line. I would like now to write another function to fit the constant compliance region. In a nutshell, I use FindLevel to find the subrange of the wave to fit and then I do the fitting. The FindLevel works, but the fitting doesn't (return a null wave as W_coef). I guess the problem is in the way I call the X wave in the fitting (dis_V_app below), which is called using $ from a wavelist. I called the wave as wave/T, which is the only way as not to have errors during compile, but I am not sure it is the actually correct way. Here below is the function, if someone has some suggestion it would be highly appreciated.
Function InvOLS_correction (startV, endV) variable startV, endV // Make a new wavelist with the baseline corrected waves SetDataFolder Root:FC_BLcorrected string InvOLSList = wavelist("*",";","") NewDataFolder/O/S Root:FC_InvOLScorrected Make/O/T/N=(itemsinlist(InvOLSList)) BLcorrectedFC Wave_From_String (InvOLSList, BLcorrectedFC) DeletePoints 0,1, BLcorrectedFC DeletePoints 1,2, BLcorrectedFC variable i=0 variable j=0 variable k=0 wave/T RawFC for (i=0; i<numpnts(BLcorrectedFC); i=i+2) Duplicate/O $("Root:FC_BLcorrected:"+BLcorrectedFC[i]), $("Defl_V_App_CC"+num2str(j)) wave defl_V_App_CC = $("Defl_V_App_CC"+num2str(j)) wave dis_V_app =$("Root:Force_Curves:"+RawFC[k+2]) wave W_coef variable V_LevelX // transform the input value in volt in the corresponding x (position in the wave of the y value) FindLevel/P/Q Defl_V_app_CC, startV variable startV_app=floor(V_levelX) print startV_app FindLevel/P/Q Defl_V_app_CC, endV variable endV_app=floor(V_levelX) print endV_app CurveFit/NTHR=0 line defl_V_App_CC[startV_app, endV_app] /X=dis_V_app/D print W_Coef j=j+1 k=k+2 endfor End function</span>
June 12, 2018 at 12:12 am - Permalink
June 12, 2018 at 12:52 am - Permalink
June 12, 2018 at 02:12 am - Permalink
June 12, 2018 at 02:17 am - Permalink
June 12, 2018 at 02:17 am - Permalink
June 12, 2018 at 06:28 am - Permalink
thanks for your answer. I tryed your suggestion but nothing changes. I suspect that the problem is how I call the X wave of the fitting, because if I write it explicitly the fitting works (of course only for the wave I declared, meaning wave with the index 10 out of the group of waves I want to fit):
June 12, 2018 at 06:48 am - Permalink
June 12, 2018 at 08:25 am - Permalink
June 13, 2018 at 01:47 am - Permalink
June 13, 2018 at 06:31 am - Permalink
June 13, 2018 at 08:00 am - Permalink
June 13, 2018 at 08:05 am - Permalink
June 20, 2018 at 05:02 am - Permalink
June 20, 2018 at 05:02 am - Permalink
June 20, 2018 at 06:19 am - Permalink