using statset for changing the properties in matlab

444 views Asked by At

Trying to change the optimopts properties of the factoran function, namely, TolX and TolFun in Matlab but apparently the values are still remaining as the default:

 optionsFactoran = statset('TolX',1e-4,'TolFun',1e-4)

and then using the factor analysis function:

[lambda,psi,T,stats,F] = factoran(MyMatrix,10,'optimopts',optionsFactoran);

as can be seen here, the values are still the default:

>> statset('factoran')

ans = 

      Display: 'off'
  MaxFunEvals: 400
      MaxIter: 100
       TolBnd: []
       TolFun: 1.0000e-08
   TolTypeFun: []
         TolX: 1.0000e-08
     TolTypeX: []
      GradObj: []
     Jacobian: []
    DerivStep: []
  FunValCheck: []
       Robust: []
 RobustWgtFun: []
       WgtFun: []
         Tune: []
  UseParallel: []
UseSubstreams: []
      Streams: {}
    OutputFcn: []

any ideas are appreciated.

1

There are 1 answers

1
Sam Roberts On BEST ANSWER

Calling statset with an output argument (as you do at the start of your question) gives you a structure of Statistics Toolbox options that you can pass in to functions such as factoran. If you display the structure, you'll see that it always contains a field for each of the Statistics Toolbox options, and each has an empty value, other than the ones you specified as inputs.

You haven't "set" anything permanently (there are no global "settings" to set), you've just created a structure containing some options. You can run statset again with different inputs, and it will just give you another options structure - again, nothing global has been set.

Calling statset with no output arguments (as you do at the end of your question) and with a function name such as factoran as input just shows you the defaults for a particular function. In other words, these are the values that would be used if you didn't pass in an options structure to specify other values.

Those are always the defaults for that function - you can't change them. If you want to use something different, you create an options structure and pass it in.