Extract # Coefs from FitFunc
geologic
I would like to utilize something like the //CurveFitDialog/ Coefficients 3 line from standard global FitFunc usage so that I can modify the size of the CoefDataSetLinkage matrix for whatever number of coefficients are present.
How can I extract a variable returning the number of coefficients in a fitfunction without doing it manually?
string Fitname
//Try Dialog method
string str=ProcedureText(Fitname,-1)
variable SPos, EPos
//Beginning of line
SPos=strsearch(str,"//CurveFitDialog/ Coefficients" ,0,2)+30
EPos=strsearch(str,"\r" ,SPos+1,2)-1
str=str[SPos,EPos]
variable Num=str2num(str)
if(numtype(Num) == 0 && Num!= 0)
return Num
else
return -1
endif
return -1
end
March 24, 2017 at 01:46 pm - Permalink
wave coef
//Coef description
//Coef[0]: CoefInfo0
//Coef[1]: CoefInfo1
//Coef[2]: CoefInfo2
variable x
return 0
end
function/S getfitfuncoef(fitname)
string fitname
string s1=proceduretext(fitname,0)
string s2=greplist(s1,"//Coef\\[\\d+\\]:",0,"\r")
variable i,n
string s3,s4,s5
s5="";
n=itemsinlist(s2,"\r")
for(i=0;i<n;i+=1)
s3=stringfromlist(i,s2,"\r")
splitstring/E="//Coef\\[\\d+\\]:\\s([a-zA-Z\\d]+)" s3,s4
s5=s5+s4+";"
endfor
return s5
end
<pre><code class="language-igor">
March 24, 2017 at 09:15 pm - Permalink
March 26, 2017 at 06:59 am - Permalink
I felt this question is relevant to this discussion, hence I am asking.
How do I get fit Coefficients if I am using curve fit in a loop?
Thanks in advance
March 30, 2017 at 03:58 pm - Permalink
displayhelptopic "CurveFit"
: ParametersIn every single call in the loop. You will need to store them after the fit in 'user' waves.
HJ
March 30, 2017 at 04:12 pm - Permalink