Main Content

convtemp

Convert to desired temperature units

Description

convertedValues = convtemp(valuesToConvert,inputTemperatureUnits,outputTemperatureUnits) computes the conversion factor from specified input temperature units (inputTemperatureUnits) to specified output temperature units (outputTemperatureUnits). The function then applies the conversion factor to the valuesToConvert.

example

Examples

collapse all

Convert three temperatures from degrees Celsius to degrees Fahrenheit.

a = convtemp([0 100 15],'C','F')
a = 1×3

   32.0000  212.0000   59.0000

Input Arguments

collapse all

Temperatures to convert, specified as an m-by-n floating-point array. All values must have the same units to be converted.

Data Types: double | single

Unit of temperature to convert:

'K'Kelvin
'F'Degree Fahrenheit
'C'Degree Celsius
'R'Degree Rankine

Data Types: char | string

Unit of temperature to convert to:

'K'Kelvin
'F'Degree Fahrenheit
'C'Degree Celsius
'R'Degree Rankine

Data Types: char | string

Output Arguments

collapse all

Converted temperature, output as a floating-point array.

Version History

Introduced in R2006b