help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ayuda


From: Liam Groener
Subject: Re: ayuda
Date: Mon, 07 Nov 2011 22:17:09 -0800


On Nov 7, 2011, at 7:29 PM, rolando rios cruz wrote:

Hi


I need a code to calculate temperatures celsius, fahrenheit, kelvin and Rankine I am creating a chain to introduce the temperature (in format valor_escala) and depending on the scale that interferes (already be C=celsius, K=Kelvin, R=Rankine, F=Fahrenheit) the conversions were realized.
Only I need to be able separate like a "string" to separate the value of the temperature and the letter that interferes to know that process realized.
Thank you

I'm not sure I understand entirely, but what about a script something like:

s = input('Input temperature','s')
deg = s(end);
tempr = str2num(s(1:end-1));
switch deg
   case 'K'
      tk = strcat(num2str(tempr),'K');
      tc = strcat(num2str(tempr-273),'C');
      tr = strcat(num2str(temor*1.8),'R');
      tf = strcat(num2str(temp*1.8-460),'F');
   case 'C'
      .
      .
   case 'R'
      .
      .
   case 'F'
      .
      .
   otherwise
      .
      .
   end
     .
     .


reply via email to

[Prev in Thread] Current Thread [Next in Thread]