what exactly does parse_inputs in matlab do? -


i reading cluster function in bioinformatics toolbox of matlab now. see cluster.m.

now stucked fifth line of following code.

function [clus, nclus, steps]=cluster(tr,v,varargin) numbranches=size(tr.tree,1); numleaves=numbranches+1; numlabels=numbranches+numleaves; [criteria, p, n]=parse_inputs(tr, numleaves, varargin{:}); 

this error

i got varargin{:} variable number of arguments of function.

but happened here? time , attention.

it's local function. scroll down below see it.

whenever see unfamiliar function, type which followed function name check if it's matlab function; if is, type help more info on how use it, , if isn't that's cue go in code.

also, matlab's build-in functions don't use underscores in naming (afaik), can dead giveaway function you're looking @ isn't mathworks.

from linked file:

function [criteria,p,n] = parse_inputs(tr,numleaves,varargin) % parse varargin parameter/value inputs  % check have right number of pvp inputs if rem(numel(varargin),2)~= 0     error('bioinfo:phytree:cluster:incorrectnumberofarguments',...         'incorrect number of arguments %s.',mfilename); end  % allowed inputs okargs = {'criterion','distances','maxclust'};  % set default values p = squareform(pdist(tr)); % pairwise distances, stored in square form                             % since indexed row , columns n = inf; % default maximum number of clusters criteria = 'm'; % maximum default criteria  j=1:2:numel(varargin)-1     [k, pval] = bioinfoprivate.pvpair(varargin{j}, varargin{j+1}, okargs, ['phytree:' mfilename]);     switch(k)         case 1 % 'criterion'             crits = {'maximum','average','median','silhouette','gain','ratio'};             crit = strmatch(lower(pval),crits);             if isempty(crit)                 error('bioinfo:phytree:cluster:notvalidcriterion',...                     'not valid criterion.')             elseif numel(crit)>1                 error('bioinfo:phytree:cluster:ambiguouscriterion',...                     'ambiguous criterion.')             else                 codes = 'madsgr';                 criteria = codes(crit);             end         case 2 % 'distances'             if isnumeric(pval) && isequal(size(pval),[numleaves,numleaves]) && all(~diag(pval)) && isequal(pval,pval')                  p = pval;             elseif isnumeric(pval) && isvector(pval) && numel(pval)==(numleaves*(numleaves-1)/2)                 p = squareform(pval);             else                 error('bioinfo:phytree:cluster:invaliddistances',...                        'distances must compatible output of seqpdist, pdist, or phytree/pdist.')              end         case 3 % 'maxclust'             if ~isnumeric(pval) || ~isscalar(pval) || rem(pval,1) || pval<1                  error('bioinfo:phytree:cluster:invalidmaxclust',...                        'maxclust must positive integer.')             end             n = pval;     end end 

Comments

Popular posts from this blog

shopping cart - Page redirect not working PHP -

php - How to modify a menu to show sub-menus -

python - Installing PyDev in eclipse is failed -