www.gusucode.com > mbcdata 工具箱 matlab 源码程序 > mbcdata/@cgoptim/getRunAPIVersion.m

    function v = getRunAPIVersion(optim)
%GETRUNAPIVERSION Return the API version to run the optimization with.
%
%   V = GETRUNAPIVERSION(OPTIM) returns the API version that the
%   optimization should be run with.  This will be either 2 or 3.

%   Copyright 2005 The MathWorks, Inc.


% Check what the script setup section wants to let us do
v = getScriptRunAPIMode(optim);

if v==-1
    % Use the interface that the cgoptim mode specifies
    v = optim.RunAPIMode;
end
    
if v==0
    % Use the latest interface version: currently 3
    v = 3;
end