Thursday, April 13, 2017

Undefined functions while using struct and optim packages in Octave

If you have encountered errors like these in octave:


error: 'cell2fields' undefined near line 939 column 11
error: called from
    __nonlin_residmin__> at line -1 column -1
    __lm_svd__ at line 191 column 9
    __nonlin_residmin__ at line 1128 column 21
    nonlin_curvefit at line 83 column 18
    nlinfit at line 169 column 18

OR these

error: '__collect_constraints__' undefined near line 152 column 7
error: called from
    __nonlin_residmin__ at line 151 column 48
    nonlin_curvefit at line 83 column 18
    nlinfit at line 169 column 18



mean that NOT all the functions in the packages struct or optim have been correctly imported into Octave.


istread of importing the single folders in the Octave's path:


addpath('/home/eddie/octave/struct-1.0.14') % NOT ENOUGH!!!
addpath('/home/eddie/octave/optim-1.5.2')   % NOT ENOUGH!!!


just use the pkg command:


pkg load struct ;
pkg load optim ;

That's it. Happy scientific programming :)