Home > published > printCelsius.m

printCelsius

PURPOSE ^

PRINTCELSIUS Assumes input in degrees Fahrenheit.

SYNOPSIS ^

function printCelsius( F )

DESCRIPTION ^

PRINTCELSIUS Assumes input in degrees Fahrenheit.
   Prints degrees Celsius and Degrees Fahrenheit.  Returns nothing.
   Provides an example of a function that takes an input but returns
   nothing.

USAGE: printCelsius(212)
   ans =   100   

history: v1.0 by R.Sonnenfeld, 9/4/2006

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

function printCelsius( F )
%PRINTCELSIUS Assumes input in degrees Fahrenheit.
%   Prints degrees Celsius and Degrees Fahrenheit.  Returns nothing.
%   Provides an example of a function that takes an input but returns
%   nothing.
%
%USAGE: printCelsius(212)
%   ans =   100
%
%history: v1.0 by R.Sonnenfeld, 9/4/2006

if length(F)>1 error('printCelsius expects only a single input Temperature (no vectors)'); end

C=(5/9)*(F-32);
fprintf('%7.2f F = %7.2f C\n',F,C)

end

Generated on Fri 07-Nov-2008 13:46:59 by m2html © 2005