%get screen information
scrsz=get(0,'screensize');
%set a figure
fig=figure;
set(fig,'Position',[scrsz(3)/4-100 scrsz(4)/4 670 445],'Name','Unit Convertor by LI ZhiJie published on: www.iLoveMatlab.cn');
set(fig,'menubar','none','numbertitle','off','resize','off','color',[0.925 0.914 0.847],'windowstyle','normal');
f=uimenu(fig,'label','&File');
uimenu(f,'label','Quit','position',2,'callback','close','separator','on','accelerator','Q','callback','close');
uimenu(f,'label','Save','position',1,'accelerator','S','callback',...
['prompt={''Unit_sheet_number:'',''Data_sheet_number:''};'...
'dlg_title=''Sheetnumber_Input'';'...
'num_lines=1;'...
'def={''1'',''2''};'...
'answer=inputdlg(prompt,dlg_title,num_lines,def);'...
'Unit_Datasheet=str2num(cell2mat(answer));'...
'Usheet=Unit_Datasheet(1);'...
'Dsheet=Unit_Datasheet(2);'...
'xlswrite(''exportdata.xls'',list1_str,Usheet); xlswrite(''exportdata.xls'', list2_dat,Dsheet);'...
]);
d=uimenu(fig,'label','&Help');
uimenu(d,'label','Help','position',1,'accelerator','H','callback','run(''help_English2'');');
uimenu(d,'label','About','position',2,'accelerator','A','callback','run(''About_English2'');');
%set a panel
Pane=uipanel('position',[0.325 0.063 0.668 0.93],'bordertype','beveledout','borderwidth',2);
%set a listbox for choose of unit field
uicontrol(fig,'style','text','position',[30 413 150 30],...
'string',{'Choose the Field of Units','in the listbox below'},'fontname','MS Sans Serif','fontsize',10,...
'foregroundcolor',[0 0 1],'horizontalalignment','center');
unittype_choose2=uicontrol(fig,'style','listbox','position',[5 30 210 379],...
'string',{'Length','Area','Volume','Mass','Density','Time','Speed',...
'Acceleration','Plane Angle','Steradian','Angular Velocity','Temperature','Angular Acceleration','Frequency',...
'Force','Torque','Moment of Inertia','Energy','Power','Pressure','Dynamic Viscosity',...
'Kinematic Viscosity','Surface Tension','Volume Flux','Mass Flux','Heat-transfer Coefficient','Thermal Conductivity','Heat Flux',...
'Specific Enthalpy','Heat Capacity','Specific Heat Capacity','Gas Constant','Current','Charge Quantity','Potential',...
'Resistance','Capacitance','Inductance','Magnetic Flux','Magnetic Flux Density','Magnetic Field Intensity','Luminous Intensity',...
'Brightness','Illuminance','Absorbed Dose','Radiation Length','Exchange Rate',...
},'Enable','on','fontname','MS Sans Serif',...
'fontsize',11,'foregroundcolor',[0 0 0],'backgroundcolor',[0.925 0.914 0.847],...
'horizontalAlignment','center','fontweight','bold');
%set two information text
uicontrol(fig,'style','text','position',[10 3 600 20],...
'string','Developed by LI ZhiJie published on the Matlab Chinese Forums: www.iLoveMatlab.cn','fontname','MS Sans Serif','fontsize',10,...
'foregroundcolor',[0 0 0],'horizontalalignment','left');
remind1=uicontrol(Pane,'style','text','position',[215 378 218 30],...
'string',{'Left: Data input and Unit Choose ','Right: Result of Conversion'},'fontname','MS Sans Serif','fontsize',10,...
'foregroundcolor',[0 0 1],'horizontalalignment','center');
%set two listboxes, one for original unit choose, one for display of conversion result
unit_listbox1=uicontrol(Pane,'style','listbox','position',[5 5 216 368],...
'string','','fontname','MS Sans Serif',...
'fontsize',10,'foregroundcolor',[0 0 1],'backgroundcolor',[1 1 1],'value',1);
unit_listbox2=uicontrol(Pane,'style','listbox','position',[225 5 216 368],...
'string','','fontname','MS Sans Serif',...
'fontsize',10,'foregroundcolor',[1 0 0],'backgroundcolor',[0.925 0.914 0.847],...
'fontweight','bold','horizontalAlignment','right');
%set an Edit object for data input
dataA=uicontrol(Pane,'style','edit','position',[5 380 198 25],...
'string','1','fontname','MS Sans Serif','fontsize',10,...
'foregroundcolor',[0 0 1],'horizontalalignment','center',...
'backgroundcolor',[1 1 1]);
%set quick menu in three listboxes
%set quick menu of unittype_choose2
qmenu_1=uicontextmenu;
qmenu_11=uimenu(qmenu_1,'label','Fontcolor');
qmenu_12=uimenu(qmenu_1,'label','Backcolor');
uimenu(qmenu_11,'label','Red','Callback','set(unittype_choose2,''foregroundcolor'',''r''),');
uimenu(qmenu_11,'label','Green','Callback','set(unittype_choose2,''foregroundcolor'',''g''),');
uimenu(qmenu_11,'label','Blue','Callback','set(unittype_choose2,''foregroundcolor'',''b''),');
uimenu(qmenu_12,'label','White','Callback','set(unittype_choose2,''backgroundcolor'',[1 1 1]),');
uimenu(qmenu_12,'label','Gray','Callback','set(unittype_choose2,''backgroundcolor'',[0.925 0.914 0.847]),');
set(unittype_choose2,'uicontextmenu',qmenu_1);
%set quick menu of unit_listbox1
qmenu_2=uicontextmenu;
qmenu_21=uimenu(qmenu_2,'label','Fontcolor');
qmenu_22=uimenu(qmenu_2,'label','Backcolor');
uimenu(qmenu_21,'label','Red','Callback','set(unit_listbox1,''foregroundcolor'',''r''),');
uimenu(qmenu_21,'label','Green','Callback','set(unit_listbox1,''foregroundcolor'',''g''),');
uimenu(qmenu_21,'label','Blue','Callback','set(unit_listbox1,''foregroundcolor'',''b''),');
uimenu(qmenu_22,'label','White','Callback','set(unit_listbox1,''backgroundcolor'',[1 1 1]),');
uimenu(qmenu_22,'label','Gray','Callback','set(unit_listbox1,''backgroundcolor'',[0.925 0.914 0.847]),');
set(unit_listbox1,'uicontextmenu',qmenu_2);
%set quick menu of unit_listbox2
qmenu=uicontextmenu;
qmenu1=uimenu(qmenu,'label','Fontcolor');
qmenu2=uimenu(qmenu,'label','Backcolor');
uimenu(qmenu1,'label','Red','Callback','set(unit_listbox2,''foregroundcolor'',''r''),');
uimenu(qmenu1,'label','Green','Callback','set(unit_listbox2,''foregroundcolor'',''g''),');
uimenu(qmenu1,'label','Blue','Callback','set(unit_listbox2,''foregroundcolor'',''b''),');
uimenu(qmenu2,'label','White','Callback','set(unit_listbox2,''backgroundcolor'',[1 1 1]),');
uimenu(qmenu2,'label','Gray','Callback','set(unit_listbox2,''backgroundcolor'',[0.925 0.914 0.847]),');
uimenu(qmenu,'label','export','separator','on','callback',...
['prompt={''Unit_sheet_number:'',''Data_sheet_number:''};'...
'dlg_title=''Sheetnumber_Input'';'...
'num_lines=1;'...
'def={''1'',''2''};'...
'answer=inputdlg(prompt,dlg_title,num_lines,def);'...
'Unit_Datasheet=str2num(cell2mat(answer));'...
'Usheet=Unit_Datasheet(1);'...
'Dsheet=Unit_Datasheet(2);'...
'xlswrite(''exportdata.xls'',list1_str,Usheet); xlswrite(''exportdata.xls'', list2_dat,Dsheet);'...
]);
set(unit_listbox2,'uicontextmenu',qmenu);
%set callback
%set callback of unittype_choose
set(unittype_choose2,'callback',...
[...
'a=get(unittype_choose2,''Value'');'...
'set(unit_listbox1,''Value'',1);'...
'if a==1;'...
'set(unit_listbox1,''String'',{''m'',''km'',''dm'',''cm'',''mm'',''m'',''nm'',''n mile'',''mile'',''yd'',''ft'',''in'','...
'''A'',''l.y.'',''fermi'',''mil'',''link''},''Enable'',''on'');'...
'elseif a==2;'...
'set(unit_listbox1,''String'',{''m^2'',''km^2'',''dm^2'',''cm^2'',''mile^2'',''acre'',''yd^2'',''ft^2'','...
'''in^2'',''ha'',''are'',''mm^2''},''Enable'',''on'');'...
'elseif a==3;'...
'set(unit_listbox1,''String'',{''m^3'',''L'',''dl'',''cl'',''ml'',''dm^3'',''cm^3'',''ft^3'',''in^3'',''Brit.gal'','...
'''U.S.gal''},''Enable'',''on'');'...
'elseif a==4;'...
'set(unit_listbox1,''String'',{''kg'',''t'',''g'',''mg'',''lb'',''oz'',''kgf*s^2/m'',''long ton'',''sh ton'','...
'''carat(diamond)'',''carat(gold)'',''Da'',''stone''},''Enable'',''on'');'...
'elseif a==5;'...
'set(unit_listbox1,''String'',{''kg/m^3'',''g/cm^3'',''lb/ft^3'',''lb/in^3'','' ton/yd^3'',''slug/ft^3'',''lb/Brit.gal'',''lb/U.S.gal'',''ton/m^3'','...
'''kg/L''},''Enable'',''on'');'...
'elseif a==6;'...
'set(unit_listbox1,''String'',{''a'',''m'',''d'',''h'',''min'',''s''},''Enable'',''on'');'...
'elseif a==7;'...
'set(unit_listbox1,''String'',{''m/s'',''km/h'',''m/h'',''knot'',''ft/h'',''ft/min'',''ft/s'',''in/s'',''mile/h'','...
'''kine''},''Enable'',''on'');'...
'elseif a==8;'...
'set(unit_listbox1,''String'',{''m/s^2'',''ga'',''cm/s^2'',''ft/s^2'',''Cal'',''ft/s^2''},''Enable'',''on'');'...
'elseif a==9;'...
'set(unit_listbox1,''String'',{''radian'',''degree'',''minute'',''second'',''gon'',''mil''},''Enable'',''on'');'...
'elseif a==10;'...
'set(unit_listbox1,''String'',{''sr'',''sphere'',''deg^2'',''min^2'',''s^2'',''gon^2''},''Enable'',''on'');'...
'elseif a==11;'...
'set(unit_listbox1,''String'',{''rad/s'',''rad/min'',''r/s'',''r/min'',''deg/s'',''deg/min''},''Enable'',''on'');'...
'elseif a==12;'...
'set(unit_listbox1,''String'',{''K'',''C'',''F''},''Enable'',''on'');'...
'elseif a==13;'...
'set(unit_listbox1,''String'',{''rad/s^2'',''deg/s^2''},''Enable'',''on'');'...
'elseif a==14;'...
'set(unit_listbox1,''String'',{''Hz'',''fresnel''},''Enable'',''on'');'...
'elseif a==15;'...
'set(unit_listbox1,''String'',{''N'',''dyn'',''kgf'',''lbf'',''poundal'',''tf''},''Enable'',''on'');'...
'elseif a==16;'...
'set(unit_listbox1,''String'',{''N*m'',''kgf*m'',''lbf*ft'',''lbf*in''},''Enable'',''on'');'...
'elseif a==17;'...
'set(unit_listbox1,''String'',{''kg*m^2'',''kg*cm^2'',''kg*mm^2'',''g*cm^2'',''lb*ft^2'',''lb*in^2''},''Enable'',''on'');'...
'elseif a==18;'...
'set(unit_listbox1,''String'',{''J'',''erg'',''kgf*m'',''kW*h'',''lbf*ft'',''B.t.u'','...
'''hp*h'',''W*h'',''eV'',''cal(steam international table)'',''cal(average)'',''cal(thermal chemistry)'',''tonTNT'',''kW*h'',''latm''},''Enable'',''on'');'...
'elseif a==19;'...
'set(unit_listbox1,''String'',{''W'',''kW'',''erg/s'',''kgf*m/s'',''kcal/s'',''lbf*ft/s'','...
'''Btu/s'',''kcal/h'',''Brit.hp'',''Metric hp'',''cal/s''},''Enable'',''on'');'...
'elseif a==20;'...
'set(unit_listbox1,''String'',{''Pa'',''N/m^2'',''bar'',''mmH2O'',''dyn/cm^2'',''atm'','...
'''at'',''mmHg'',''lbf/in^2'',''MPa'',''ft Hg'',''ft H2O'',''kPa'',''kgf/m^2''},''Enable'',''on'');'...
'elseif a==21;'...
'set(unit_listbox1,''String'',{''Pa*s'',''kg/(m*s)'',''P'',''cP'',''kgf*s/m^2'',''lbf*h/ft^2'','...
'''lbf*s/ft^2'',''lbf*s/ft^2'',''lbf*s/in^2''},''Enable'',''on'');'...
'elseif a==22;'...
'set(unit_listbox1,''String'',{''m^2/s'',''m^2/h'',''cm^2/s'',''ft^2/h'',''ft^2/s'',''in^2/h'','...
'''in^2/h'',''St'',''cSt''},''Enable'',''on'');'...
'elseif a==23;'...
'set(unit_listbox1,''String'',{''N/m'',''dyn/cm'',''kgf/m'',''lbf/ft'',''g/cm''},''Enable'',''on'');'...
'elseif a==24;'...
'set(unit_listbox1,''String'',{''m^3/s'',''m^3/h'',''L/h'',''L/s'',''m^3/min'',''L/min'','...
'''ml/h'',''ml/min'',''ml/s'',''ft^3/h'',''ft^3/s'',''m^3/d''},''Enable'',''on'');'...
'elseif a==25;'...
'set(unit_listbox1,''String'',{''kg/s'',''g/s'',''t/h'',''kg/h'',''t/min'',''kg/min'','...
'''g/min'',''lb/s'',''lg/h''},''Enable'',''on'');'...
'elseif a==26;'...
'set(unit_listbox1,''String'',{''W/(m^2*K)'',''cal/(cm^2*s*K)'',''kcal/(m^2*h*K)'',''Btu/(ft^2*h*F)''},''Enable'',''on'');'...
'elseif a==27;'...
'set(unit_listbox1,''String'',{''W/(m*K)'',''cal/(cm*s*K)'',''kcal/(m*h*K)'',''kcal/(m*h*C)'',''Btu/(ft*h*F)''},''Enable'',''on'');'...
'elseif a==28;'...
'set(unit_listbox1,''String'',{''W/m^2'',''kcal/m^2*h'',''kcal/cm^2*s'',''Btu/ft^2*h'',''W/in^2''},''Enable'',''on'');'...
'elseif a==29;'...
'set(unit_listbox1,''String'',{''J/kg'',''kcal/kg'',''Btu/lb'',''cal/g''},''Enable'',''on'');'...
'elseif a==30;'...
'set(unit_listbox1,''String'',{''J'',''Ca'',''Cl''},''Enable'',''on'');'...
'elseif a==31;'...
'set(unit_listbox1,''String'',{''J/(kg*K)'',''kcal/(kg*K)'',''Btu/(lb*F)'',''cal/(g*K)''},''Enable'',''on'');'...
'elseif a==32;'...
'set(unit_listbox1,''String'',{''R'',''kJ/(kmol*K)'',''cal/(mol*K)'',''atm*cm^3/(mol*K)'',''atm*m^3/(kmol*K)''},''Enable'',''on'');'...
'elseif a==33;'...
'set(unit_listbox1,''String'',{''A'',''aA'',''sA'',''Bi'',''Aint''},''Enable'',''on'');'...
'elseif a==34;'...
'set(unit_listbox1,''String'',{''C'',''kC'',''mC'',''aC'',''sC'',''A*h''},''Enable'',''on'');'...
'elseif a==35;'...
'set(unit_listbox1,''String'',{''V'',''aV'',''sV'',''Vint''},''Enable'',''on'');'...
'elseif a==36;'...
'set(unit_listbox1,''String'',{'''',''a'',''s'',''int''},''Enable'',''on'');'...
'elseif a==37;'...
'set(unit_listbox1,''String'',{''F'',''aF'',''sF'',''Fint'',''F'',''nF'',''pF''},''Enable'',''on'');'...
'elseif a==38;'...
'set(unit_listbox1,''String'',{''H'',''aH'',''H'',''mH'',''sH''},''Enable'',''on'');'...
'elseif a==39;'...
'set(unit_listbox1,''String'',{''Wb'',''Mx''},''Enable'',''on'');'...
'elseif a==40;'...
'set(unit_listbox1,''String'',{''T'',''Gs'','''',''aT''},''Enable'',''on'');'...
'elseif a==41;'...
'set(unit_listbox1,''String'',{''A/m'',''Oe'',''Gs'',''api''},''Enable'',''on'');'...
'elseif a==42;'...
'set(unit_listbox1,''String'',{''cd'',''C'',''carcel''},''Enable'',''on'');'...
'elseif a==43;'...
'set(unit_listbox1,''String'',{''cd/m^2'',''cd/cm^2'',''cd/ft^2'',''cd/in^2'',''asb'',''sb'',''sk'','...
'''nt'',''La'',''mLa'',''ft*L''},''Enable'',''on'');'...
'elseif a==44;'...
'set(unit_listbox1,''String'',{''lx'',''ph'',''fc''},''Enable'',''on'');'...
'elseif a==45;'...
'set(unit_listbox1,''String'',{''Gy'',''rd'',''rep''},''Enable'',''on'');'...
'elseif a==46;'...
'set(unit_listbox1,''String'',{''Bq'',''Ci'',''dph'',''emanL'',''Rd'',''St''},''Enable'',''on'');'...
'else;'...
'set(unit_listbox1,''String'',{''USD'',''RMB'',''EUR'',''GBP'',''DEM'',''FRF'',''CHF'',''JPY'',''NTD'',''HKD'','...
'''MOP'',''KOW'',''SGD'',''MYR'',''AUD'',''CAD'',''BEF'',''SEK'','...
'''NLG'',''SAR'',''ITL'',''ATS'',''DMK'',''NOK'',''PHP'',''NZD'','...
'''THB''},''Enable'',''on'');'...
'end;'...
'if a~=12;'...
'list1_str=get(unit_listbox1,''string'');'...
'multipv1=multip(a,:);'...
'clear multipv data_list2;'...
'for i=1:length(multipv1);'...
'if multipv1(i)~=0;'...
'multipv(i)=multipv1(i);'...
'else;'...
'break;'...
'end;'...
'end;'...
'b=get(unit_listbox1,''value'');'...
'multip_origin=multipv(b);'...
'cstr=get(dataA,''string'');'...
'c=str2num(cstr);'...
'C=[c];'...
'for i=1:length(multipv);'...
'data_list2(i)=C*multipv(i)/multip_origin;'...
'end;'...
'list2_dat=data_list2'';'...
'list2_dat2str=num2str(list2_dat);'...
'list2_dat_str=strcat(list2_dat2str,list1_str);'...
'list2_dat_str_left=strjust(list2_dat_str,''left'');'...
'set(unit_listbox2,''string'',list2_dat_str_left);'...
'else;'...
'list1_str=get(unit_listbox1,''string'');'...
'b=get(unit_listbox1,''value'');'...
'cstr=get(dataA,''string'');'...
'c=str2num(cstr);'...
'C=[c];'...
'clear data_list2;'...
'if b==1;'...
'data_list2(1)=C;'...
'data_list2(2)=C-273.5;'...
'data_list2(3)=C*9/5-459.67;'...
'elseif b==2;'...
'data_list2(1)=C+273.5;'...
'data_list2(2)=C;'...
'data_list2(3)=C*9/5+32;'...
'else;'...
'data_list2(1)=(C+459.67)*5/9;'...
'data_list2(2)=(C-32)*5/9;'...
'data_list2(3)=C;'...
'end;'...
'list2_dat=data_list2'';'...
'list2_dat2str=num2str(list2_dat);'...
'list2_dat_str=strcat(list2_dat2str,list1_str);'...
'list2_dat_str_left=strjust(list2_dat_str,''left'');'...
'set(unit_listbox2,''string'',list2_dat_str_left);'...
'end;']);
%define (multiple table)
multip=[1 0.001 10 100 1000 1000000 1000000000 0.000539957 0.000621388 1.093613298 3.280839895 39.37007874 10000000000 1.05708E-16 1E+15 39370.07874 4.97096953 0 0 0 0 0 0 0 0 0 0;
1 0.000001 100 10000 3.861E-07 0.000247105 1.196029183 10.76426265 1550.0031 0.0001 0.01 1000000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
1 1000 10000 100000 1000000 1000 1000000 35.3147 61024 219.975 264.171 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
1 0.001 1000 1000000 2.2046 35.2739907 0.101967982 0.0009842 0.0011023 5000 64.3004 6.02E+26 0.15747312 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
1 0.001 0.6243 0.00003613 0.0007524 0.00194 10.02 8.345 0.001 0.001 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
1 12 365.24 8765.8128 525948.768 31556926.08 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
1 3.6 3600 1.944 11811 196.85 3.28083333 39.37 2.23693 100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
1 0.10197162 100 3.280309983 100 3.28083 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
1 57.2958 3437.748 206264.88 63.662 1000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
1 0.07957747 3282.994091 11818778.4 42547602240 4052.8491 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
1 60 0.159155 9.5493 57.2958 3437.748 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
1 57.2967 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
1 1.00E-12 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
1 100000 0.10197162 0.2248 7.233 0.000101972 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
1 0.1019716 0.73756 8.85072 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
1 10000 1000000 10000000 23.730422 3417.16785 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
1 10000000 0.10197 2.78E-07 0.7377 0.0009486 3.73E-07 0.000277778 6.24E+18 0.23884 0.238663 0.239005 2.39234E-10 2.777778E-7 0.00986923 0 0 0 0 0 0 0 0 0 0 0 0;
1 0.001 10000000 0.10197162 0.000238846 0.73556 0.0009486 0.8598456 0.00134102 0.00136051 0.238846 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
1 1 0.00001 0.10197162 10 9.87E-06 1.02E-05 0.0075 0.000145 1.00E-06 2.46E-05 0.00033456 0.001 0.10197162 0 0 0 0 0 0 0 0 0 0 0 0 0;
1 1 10 1000 0.10197162 5.80E-06 0.0208854 4.03E-08 0.000145008 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
1 3600 10000 38750 10.7638889 5580014 1550 10000 1000000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
1 1000 0.102 0.06852 1.02 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
1 3600 3600000 1000 60 60000 3600000000 60000000 1000000 127132.8 35.314666 86400 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
1 1000 3.6 3600 0.06 60 60000 2.2046244 7936.64784 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
1 2.39E-05 0.859845 0.17611 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
1 0.00238846 0.000238846 0.8598456 0.57779 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
1 0.859845 2.39E-05 0.3169984 0.00064516 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
1 0.0002389 0.0004299 0.0002389 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
1 1 0.2390057 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
1 0.000238846 0.000238846 0.000238846 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
1 8.314 1.987 82.06 0.08206 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
1 0.1 2997924530 0.1 1.000150023 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
1 0.001 1000 0.1 299792540 0.000277778 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
1 100000000 0.003335646 0.999660116 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
1 1000000000 1.11E-12 0.99951024 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
1 1.00E-09 8.98755E+11 1.00049024 1000000 1000000000 1E+12 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
1 1000000000 1000000 1000 1.11E-12 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
1 100000000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
1 10000 1000000000 10000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
1 0.1256637 0.001 0.0254 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
1 1 0.103018 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
1 0.0001 0.0929 0.0006452 3.14159 0.0001 3141.59 1 0.000314159 0.314159 0.2918634 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
1 0.0001 0.0929031 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
1 100 119.3317 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
1 2.70E-11 0.000277778 0.27027 1.00E-06 7425.0074 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
1 8 1.08762 0.6863 1.7076 5.393 1.57954 137.9467 25.079 7.80388 8.1145 1000 1.7954 2.506 1.80716 1.54418 32.584 10.0937 1.809 2.809 1183.034 11.236 8.11451 8.19485 51.73 2.14982 43.5621];
%set callback of unitlistbox1
set(unit_listbox1,'callback',...
['a=get(unittype_choose2,''value'');'...
'if a~=12;'...
'list1_str=get(unit_listbox1,''string'');'...
'multipv1=multip(a,:);'...
'clear multipv data_list2;'...
'for i=1:length(multipv1);'...
'if multipv1(i)~=0;'...
'multipv(i)=multipv1(i);'...
'else;'...
'break;'...
'end;'...
'end;'...
'b=get(unit_listbox1,''value'');'...
'multip_origin=multipv(b);'...
'cstr=get(dataA,''string'');'...
'c=str2num(cstr);'...
'C=[c];'...
'for i=1:length(multipv);'...
'data_list2(i)=C*multipv(i)/multip_origin;'...
'end;'...
'list2_dat=data_list2'';'...
'list2_dat2str=num2str(list2_dat);'...
'list2_dat_str=strcat(list2_dat2str,list1_str);'...
'list2_dat_str_left=strjust(list2_dat_str,''left'');'...
'set(unit_listbox2,''string'',list2_dat_str_left);'...
'else;'...
'list1_str=get(unit_listbox1,''string'');'...
'b=get(unit_listbox1,''value'');'...
'cstr=get(dataA,''string'');'...
'c=str2num(cstr);'...
'C=[c];'...
'clear data_list2;'...
'if b==1;'...
'data_list2(1)=C;'...
'data_list2(2)=C-273.5;'...
'data_list2(3)=C*9/5-459.67;'...
'elseif b==2;'...
'data_list2(1)=C+273.5;'...
'data_list2(2)=C;'...
'data_list2(3)=C*9/5+32;'...
'else;'...
'data_list2(1)=(C+459.67)*5/9;'...
'data_list2(2)=(C-32)*5/9;'...
'data_list2(3)=C;'...
'end;'...
'list2_dat=data_list2'';'...
'list2_dat2str=num2str(list2_dat);'...
'list2_dat_str=strcat(list2_dat2str,list1_str);'...
'list2_dat_str_left=strjust(list2_dat_str,''left'');'...
'set(unit_listbox2,''string'',list2_dat_str_left);'...
'end;']);
%set callback of dataA
set(dataA,'callback',...
['a=get(unittype_choose2,''value'');'...
'if a~=12;'...
'list1_str=get(unit_listbox1,''string'');'...
'multipv1=multip(a,:);'...
'clear multipv data_list2;'...
'for i=1:length(multipv1);'...
'if multipv1(i)~=0;'...
'multipv(i)=multipv1(i);'...
'else;'...
'break;'...
'end;'...
'end;'...
'b=get(unit_listbox1,''value'');'...
'multip_origin=multipv(b);'...
'cstr=get(dataA,''string'');'...
'c=str2num(cstr);'...
'C=[c];'...
'for i=1:length(multipv);'...
'data_list2(i)=C*multipv(i)/multip_origin;'...
'end;'...
'list2_dat=data_list2'';'...
'list2_dat2str=num2str(list2_dat);'...
'list2_dat_str=strcat(list2_dat2str,list1_str);'...
'list2_dat_str_left=strjust(list2_dat_str,''left'');'...
'set(unit_listbox2,''string'',list2_dat_str_left);'...
'else;'...
'list1_str=get(unit_listbox1,''string'');'...
'b=get(unit_listbox1,''value'');'...
'cstr=get(dataA,''string'');'...
'c=str2num(cstr);'...
'C=[c];'...
'clear data_list2;'...
'if b==1;'...
'data_list2(1)=C;'...
'data_list2(2)=C-273.5;'...
'data_list2(3)=C*9/5-459.67;'...
'elseif b==2;'...
'data_list2(1)=C+273.5;'...
'data_list2(2)=C;'...
'data_list2(3)=C*9/5+32;'...
'else;'...
'data_list2(1)=(C+459.67)*5/9;'...
'data_list2(2)=(C-32)*5/9;'...
'data_list2(3)=C;'...
'end;'...
'list2_dat=data_list2'';'...
'list2_dat2str=num2str(list2_dat);'...
'list2_dat_str=strcat(list2_dat2str,list1_str);'...
'list2_dat_str_left=strjust(list2_dat_str,''left'');'...
'set(unit_listbox2,''string'',list2_dat_str_left);'...
'end;']);