view aim-mat/tools/units/unit classes/@unitbag/hasunit.m @ 4:537f939baef0 tip

various bug fixes and changed copyright message
author Stefan Bleeck <bleeck@gmail.com>
date Tue, 16 Aug 2011 14:37:17 +0100
parents 74dedb26614d
children
line wrap: on
line source
function yes=hasunit(ub,unitname);

units=ub.units;
for i=1:length(units)
    unname=getname(units{i};
    if strcmp(unname,unitname)
        yes=1;
        return
    end
end
% if still here then there was no exact match. Take the first oen with a
% close match
for i=1:length(units)
    unname=getname(units{i};
    if ~isemtpy(strfind(unname,unitname))
        yes=1;
        return
    end
end

yes=0;