Require FEX package
16 Apr 2011
(Updated 09 May 2012)
Let the user download and install those File Exchange packages, which your submission needs.
% RequireFEXpackageExample1- script demonstrating how
% the function 'requireFEXPackage' can be used to add (on demand)
% other FEX submission on which your submission relies.
% This example uses the 'exist' command.
% (C) Igor Podlubny, 2011
% first, somewhere in the very beginning of your code,
% check if the function 'fminsearchbnd' from the FEX package 8277
% is on your MATLAB path, and if it is not there,
% require the FEX package 8277:
if ~(exist('fminsearchbnd', 'file') == 2)
P = requireFEXpackage(8277); % fminsearchbnd is part of 8277
% Then just use 'fminsearchbnd':
RosenbrockBananaFunction = @(x) (1-x(1)).^2 + 100*(x(2)-x(1).^2).^2;
x = fminsearchbnd(RosenbrockBananaFunction,[3 3])