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