image thumbnail
from A Multiple Units Converter and a Calculator by Hong Zhang
It contains a units converter and a caculator using pure m files

temperature2.m
hsp = uipanel('Parent',hp,'Title','','FontSize',12,...
              'Position',[0 0 1 1]);
p=[230 370 50 20];
d1=[0 -25 0 0];
d2=[-170 0 120 0];
name=['C ','F ','K  '];

[z,k3]=size(name);
k=k3/3;
for n=1:3
    b(n)=uicontrol('style','text',...
        'string',name(3*n-2:3*n),...
        'position',p+n*d1+[0 0 250 0],...
        'FontSize',12,...
        'horizontalalignment','left');
    a(n)=uicontrol('style','edit',...
        'position',p+n*d1+d2,...
        'FontSize',12,...
        'horizontalalignment','right');
end
s=uicontrol('style','text',...
    'string','  ',...
    'position',[60 95 450 195]);


set(a(1),'callback',['v1=get(a(1),''string'');',...
    'v1=str2num(v1);',...
    'v2=v1*9/5+32;',...
    'b2=num2str(v2);',...
    'set(a(2),''string'',b2);',...
    'v3=v1+273.15;',...
    'b3=num2str(v3);',...
    'set(a(3),''string'',b3);',...

    ]);
set(a(2),'callback',[
    'v2=get(a(2),''string'');',...
    'v2=str2num(v2);',...
    'v1=(v2-32)*5/9;',...
    'b1=num2str(v1);',...
    'set(a(1),''string'',b1);',...
    'v3=v1+273.15;',...
    'b3=num2str(v3);',...
    'set(a(3),''string'',b3);',...
    ]);
set(a(3),'callback',[
    'v3=get(a(3),''string'');',...
    'v3=str2num(v3);',...
    'v1=v3-273.15;',...
    'b1=num2str(v1);',...
    'set(a1,''string'',b1);',...
    'v2=v1*9/5+32;',...
    'b2=num2str(v2);',...
    'set(a(2),''string'',b2);',...
    ]);


Contact us at files@mathworks.com