problem with optimset not being recognized, R2012a

5 views (last 30 days)
I just loaded R2012a this morning and my old m-files are broken. I am having trouble with optimset, and just decided to put optimset in the m-file, as the help says "optimset" alone should return the options. Instead I get this error:
Undefined function or variable 'optimset'
which optimset
yields:
'optimset' not found
even though which lsqcurvefit yields: C:\Program Files\MATLAB\R2012a\toolbox\shared\optimlib\lsqcurvefit.m
Here is my output from ver: MATLAB Version: 7.14.0.739 (R2012a) MATLAB License Number: ####### [SCd Censor] Operating System: Microsoft Windows 7 Version 6.1 (Build 7601: Service Pack 1) Java Version: Java 1.6.0_17-b04 with Sun Microsystems Inc. Java HotSpot™ 64-Bit Server VM mixed mode -------------------------------------------------------------------------------------------------------
MATLAB Version 7.14 (R2012a)
Simulink Version 7.9 (R2012a)
Bioinformatics Toolbox Version 4.1 (R2012a)
Control System Toolbox Version 9.3 (R2012a)
Curve Fitting Toolbox Version 3.2.1 (R2012a)
DSP System Toolbox Version 8.2 (R2012a)
Data Acquisition Toolbox Version 3.1 (R2012a)
Image Acquisition Toolbox Version 4.3 (R2012a)
Image Processing Toolbox Version 8.0 (R2012a)
Instrument Control Toolbox Version 3.1 (R2012a)
MATLAB Compiler Version 4.17 (R2012a)
MATLAB Report Generator Version 3.12 (R2012a)
Neural Network Toolbox Version 7.0.3 (R2012a)
Optimization Toolbox Version 6.2 (R2012a)
Parallel Computing Toolbox Version 6.0 (R2012a)
Partial Differential Equation Toolbox Version 1.0.20 (R2012a)
Signal Processing Toolbox Version 6.17 (R2012a)
SimBiology Version 4.1 (R2012a)
SimMechanics Version 4.0 (R2012a)
Simscape Version 3.7 (R2012a)
Spreadsheet Link EX Version 3.1.5 (R2012a)
Stateflow Version 7.9 (R2012a)
Statistics Toolbox Version 8.0 (R2012a)
Symbolic Math Toolbox Version 5.8 (R2012a)
Wavelet Toolbox Version 4.9
What happened to my install?
Thanks

Accepted Answer

Matthew
Matthew on 7 Mar 2012
I did a complete download and reinstall. After the reinstall, I located optimset in the path Arthur suggested above, as opposed to the one I found earlier in \funfun. But still no optimset. When I started matlab in told me that my Toolbox Path Cache was out of date. I reapplied the setting under general, and it started working.
Thanks Arthur for the help.

More Answers (4)

Arthur Goldsipe
Arthur Goldsipe on 7 Mar 2012
I would first ensure that optimset.m got installed. Based on the location of your R2012a installation, look for the file at C:\Program Files\MATLAB\R2012a\toolbox\matlab\optimfun\optimset.m. If the file is not there, then the toolbox got installed incorrectly. If that's the case, I would contact technical support for further help.
If the file is there, it sounds like your MATLAB path got corrupted. From the MATLAB prompt, run the command restoredefaultpath and see if optimset is then available. If it is, you can save this restored path by running the command savepath. If you used to have some of your own directories added to the path, you will need to add them back and re-run savepath. You can also manage the path using a graphical tool, which you can open by running the pathtool command or by selecting File > Set Path from the Desktop menu.
  1 Comment
Marc Ramsey
Marc Ramsey on 28 May 2012
Thank you for this answer. I had the same problem this morning when upgrading from r2010a to r2012a, and this fixed it.

Sign in to comment.


Matthew
Matthew on 6 Mar 2012
I have not deleted R2011b. optimset is in matlab\funfun, but it is not in this folder in R2012a.
Should I reinstall?

Matthew
Matthew on 6 Mar 2012
I have reinstalled, but the problem remians, no optimset.
I installed on my laptop. NO PROBLEM!
What is the deal?
Thanks to anyone that can help.

Lea
Lea on 28 Feb 2013
I have the same problem "undefined function optimset for char' but only when running it in a "parfor loop". If I run it just as a "for loop", it works fine. The problem only occured after installing r2012b. anyone that can help?
  1 Comment
Andreas Sprenger
Andreas Sprenger on 15 Nov 2013
Optimset meanwhile resides in a separate folder. Check whether
%matlabroot%\toolbox\matlab\optimfun
is in your standard path (using path or Set Path via File Open or Ribbon).
Adding this folder resolves the problem.

Sign in to comment.

Categories

Find more on Introduction to Installation and Licensing in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!