Code covered by the BSD License  

Highlights from
Deploying the ver Command

Deploying the ver Command

by

 

Example code for "Deploying the ver Command" post in the "Art of MATLAB" blog.

classify(language)
function classify(language)
    disp('Version Information:');
    if isdeployed
        disp(ver('classify'));
    else
        disp(ver('Logographic'));
    end
    
    % Determine language classification
    lg = isIt(language, @islogographic);
    ls = isIt(language, @islogosyllabic);
    lc = isIt(language, @islogoconsonantal);
    % Make sure we emit grammatically correct English
    if strcmp(ls,lc)
        conjunction = 'and';
    else
        conjunction = 'but';
    end
    % Format and display the classification message.
    msg = ...
        sprintf('%s %s logographic, %s logosyllabic %s %s logoconsonantal.', ...
                language, lg, ls, conjunction, lc);
    disp(msg);
  
end

function txt = isIt(language, classifier)
    tst = classifier(language);
    if tst
        txt = 'is';
    else
        txt = 'isn''t';
    end
end

   

Contact us