% File: guitconv.m (an interactive GUI program for converting temperatures)  
%
% Purpose
%
% Convert entered temperatures from degrees Fahrenheit to Kelvin.
%
% Input(s)
%
% A valid temperature in degrees Fahrenheit. No error checking is done.
%
% Output(s)
%
% The Kelvin equivalent of the entered temperature.
%
% Revsion History
%
% Created 11/26/06 by Dr. C. S. Tritt
%
% Variables Used
%
% ca_tempf -- Cell array containing entered temperature.
% temp_f -- Entered temperature in Fahrenheit.
% temp_k -- Converted temperature in Kelvin.
% t_string -- String contain output message text.

%Prompt user for input dialog.
ca_temp_f = inputdlg('Enter the temperature in deg. F: ');

% inputdlg returns a cell array containing a string so extract & convert
% it.
temp_f = str2double(ca_temp_f(1));

%Convert to Kelvin
temp_k = 5./9.*(temp_f - 32.) + 273.15;

% Build the output string using concatenation operator; sprrinf could have
% also been used.
t_string = [num2str(temp_f) ' deg. F = ' num2str(temp_k) ' K'];

%Display the string in a message box.
msgbox(t_string);