annotate 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
rev   line source
tomwalters@0 1 function yes=hasunit(ub,unitname);
tomwalters@0 2
tomwalters@0 3 units=ub.units;
tomwalters@0 4 for i=1:length(units)
tomwalters@0 5 unname=getname(units{i};
tomwalters@0 6 if strcmp(unname,unitname)
tomwalters@0 7 yes=1;
tomwalters@0 8 return
tomwalters@0 9 end
tomwalters@0 10 end
tomwalters@0 11 % if still here then there was no exact match. Take the first oen with a
tomwalters@0 12 % close match
tomwalters@0 13 for i=1:length(units)
tomwalters@0 14 unname=getname(units{i};
tomwalters@0 15 if ~isemtpy(strfind(unname,unitname))
tomwalters@0 16 yes=1;
tomwalters@0 17 return
tomwalters@0 18 end
tomwalters@0 19 end
tomwalters@0 20
tomwalters@0 21 yes=0;