tomwalters@0: function newval=fromunit(ub,val,name); tomwalters@0: tomwalters@0: nr_un=getcount(ub); tomwalters@0: for i=1:nr_un tomwalters@0: cun=getunit(ub,i); tomwalters@0: if strcmp(getname(cun),name) tomwalters@0: con=getconverter(cun); tomwalters@0: newval=fromunits(con,val); tomwalters@0: return tomwalters@0: end tomwalters@0: end tomwalters@0: tomwalters@0: for i=1:nr_un tomwalters@0: cun=getunit(ub,i); tomwalters@0: if ~isempty(strfind(getname(cun),name)) tomwalters@0: con=getconverter(cun); tomwalters@0: newval=fromunits(con,val); tomwalters@0: return tomwalters@0: end tomwalters@0: end tomwalters@0: tomwalters@0: error('dont know unit')