view aim-mat/tools/units/unit classes/@unitbag/hasunit.m @ 0:74dedb26614d

Initial checkin of AIM-MAT version 1.5 (6.4.2011).
author tomwalters
date Fri, 20 May 2011 12:32:31 +0100
parents
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;