lsqcurvefi problem on Mac OS

I am trying to do a nonlinear fit to a function using lsqcurvefit. While everything works fine in a windows-based computer, on the mac I get a "Dimensions of matrices being concatenated are not consistent". Is this a known problem?

 Accepted Answer

The line "plotStr = [colors(1+mod(ind-1, length(colors))) plotOpt];" is not part of the code of /Applications/MATLAB_R2016a.app/toolbox/shared/optimlib/color.m
I suspect you have your own routine named color.m that is earlier on the path than the built-in routine. Use
which -all color
to find it.

1 Comment

Thanks a lot. You were right, problem solved.

Sign in to comment.

More Answers (1)

John D'Errico
John D'Errico on 23 Jul 2016
Edited: John D'Errico on 23 Jul 2016
No. It is a bug in your code. Since we don't know what you tried to do, or how you tried to move things between systems, we can't really answer. The one thing I can definitely say is that it is not MAC versus Windows specific issue. There simply is no MAC issue, where variables are no longer the same size.
Yes, I know that you THINK you moved things over properly between systems. But you did something different there. You might get a better answer if you show code.

1 Comment

Avi
Avi on 24 Jul 2016
Edited: Avi on 24 Jul 2016
Hi John. Thank you for your help. Below is the code i tried to use, and the error I get. Any suggestion will be greatly appreciated. Avi
>> t=[1 10 20 50 100 250];
>> v=10*t./(t+2);
>> test = @(a, x) a(1)*x./(x+a(2));
>> lsqcurvefit(@(a,t) test(a,t),[5 5],t,v)
Error using horzcat
Dimensions of matrices being concatenated are not consistent.
Error in color (line 9)
plotStr = [colors(1+mod(ind-1, length(colors))) plotOpt];
Error in snls (line 176)
group = color(Jstr,p);
Error in lsqncommon (line 166)
snls(funfcn,xC,lb,ub,flags.verbosity,options,defaultopt,initVals.F,initVals.J,caller, ...
Error in lsqcurvefit (line 257)
lsqncommon(funfcn,xCurrent,lb,ub,options,defaultopt,caller,...

Sign in to comment.

Asked:

Avi
on 23 Jul 2016

Commented:

Avi
on 24 Jul 2016

Community Treasure Hunt

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

Start Hunting!