lsqcurvefit error: output argument "s" not assigned during call to replace

1 Ansicht (letzte 30 Tage)
JJ Lamb
JJ Lamb am 15 Jun. 2021
Bearbeitet: JJ Lamb am 15 Jun. 2021
I use lsqcurvefit for a fair amount of nonlinear curvefitting. I don't think I've tried to use it since I've upgraded to 2020b, but now I'm not sure if I'm making a code error or if something got changed in the update.
I have one call to lsqcurvefit that works, and another that does not and I cannot figure it out. I've tried to code a very simple example to see what's going.
myFun = @(a,xdata) a*xdata; % f(x) = a*x
x = 1:20;
y = 2*x; % simply multiply x by 2
A = lsqcurvefit(myFun,2,x,y); % A should be 2 since I'm fitting some linear data
And then this is the error message that I get:
Output argument "s" (and maybe others) not assigned during call to "replace".
Error in snls (line 269)
msgData = {{replace(msgID,'detailed','basic')}, ...
Error in lsqncommon (line 178)
snls(funfcn,xC,lb,ub,flags.verbosity,options,defaultopt,initVals.F,initVals.J,caller, ...
Error in lsqcurvefit (line 278)
lsqncommon(funfcn,xCurrent,lb,ub,options,defaultopt,optimgetFlag,caller,...
Error in untitled2 (line 4)
A = lsqcurvefit(myFun,2,x,y);
From what I can tell, there's a problem with the call to "replace.m" in the function "snls.m"
I think it has something do with a string being defined using single quotes 'str' vs double quotes "str" before being used in the replace function in the "snls.m" file, but I'm not sure. I don't really know how I could adjust my call to lsqcurvefit to avoid getting this error or what I'm entering incorrectly.
  1 Kommentar
JJ Lamb
JJ Lamb am 15 Jun. 2021
Bearbeitet: JJ Lamb am 15 Jun. 2021
I don't have a clue what changed, but I restarted MATLAB and it seems to be working? Running the exact same code, but with no error now. Still not totally sure what was going on, so I'll just leave this up in case something else similar happens to someone else.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Introduction to Installation and Licensing finden Sie in Help Center und File Exchange

Produkte


Version

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by