Cody

# Problem 2415. Temperature Conversion Utility (Strings)

Solution 566068

Submitted on 26 Jan 2015
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Fail
%% T_in = {'100 Celsius', '50degF', '90K', strcat('111',char(176),'R')}; T_to = {'R','C','degF','kelvin'}; T_out = [671.67 10 -297.67 61.6666667]; eps = 1e-3; assert(sum(abs(T_convertor_str(T_in,T_to)-T_out)) < eps)

Error: Output argument "T_out" (and maybe others) not assigned during call to "/users/msssystem2/T_convertor_str.m>T_convertor_str".

2   Fail
%% T_in = {'10C','20degC','30 Celsius','40 Centigrade',strcat('50',char(176),'C'),'60K','70 kelvin','80 FAHRENHEIT'}; T_to = {'R','R','Rankine','deg R','R','R',strcat(char(176),'R'),'degR'}; T_out = [509.67 527.67 545.67 563.67 581.67 108 126 539.67]; eps = 1e-3; assert(sum(abs(T_convertor_str(T_in,T_to)-T_out)) < eps)

Error: Output argument "T_out" (and maybe others) not assigned during call to "/users/msssystem2/T_convertor_str.m>T_convertor_str".

3   Fail
%% T_in = {'100 DEGREES RANKINE','100degC','100K','100F','1000R','1000 centigrade','1000 deg F','1000 kelvin'}; T_to = {'C','degC',strcat(char(176),'C'),'Celsius','centigrade','deg C','degrees Celsius','CENTIGRADE'}; T_out = [-217.5944444 100 -173.15 37.7777778 282.4055556 1000 537.7777778 726.85]; eps = 1e-3; assert(sum(abs(T_convertor_str(T_in,T_to)-T_out)) < eps)

Error: Index exceeds matrix dimensions.