This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

convtemp

Convert to desired temperature units

Syntax

convertedValues = convtemp(valuesToConvert,inputTemperatureUnits,outputTemperatureUnits)

Description

example

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.

Examples

collapse all

Convert temperatures

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.

Introduced in R2006b