Mercurial > hg > aimmat
annotate aim-mat/tools/units/unit classes/@unitbag/fromunits.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 newval=fromunit(ub,val,name); |
tomwalters@0 | 2 |
tomwalters@0 | 3 nr_un=getcount(ub); |
tomwalters@0 | 4 for i=1:nr_un |
tomwalters@0 | 5 cun=getunit(ub,i); |
tomwalters@0 | 6 if strcmp(getname(cun),name) |
tomwalters@0 | 7 con=getconverter(cun); |
tomwalters@0 | 8 newval=fromunits(con,val); |
tomwalters@0 | 9 return |
tomwalters@0 | 10 end |
tomwalters@0 | 11 end |
tomwalters@0 | 12 |
tomwalters@0 | 13 for i=1:nr_un |
tomwalters@0 | 14 cun=getunit(ub,i); |
tomwalters@0 | 15 if ~isempty(strfind(getname(cun),name)) |
tomwalters@0 | 16 con=getconverter(cun); |
tomwalters@0 | 17 newval=fromunits(con,val); |
tomwalters@0 | 18 return |
tomwalters@0 | 19 end |
tomwalters@0 | 20 end |
tomwalters@0 | 21 |
tomwalters@0 | 22 error('dont know unit') |