Cody

# Problem 1576. Mean and standard deviation of times in string

Solution 2265962

Submitted on 9 May 2020 by Joshua Sonn
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   Pass
x = {'45.5','1:04.8','55.4'}; y_correct = '55.2'; z_correct = '9.7' [a,b]=mean_std(x); assert(isequal(a,y_correct)&isequal(b,z_correct))

z_correct = '9.7' a = 1×4 uint16 row vector 52 53 46 53 b = 1×8 uint16 row vector 48 58 48 58 52 53 46 53 a = '0:0:45.5' c = 45.5000 a = 1×6 uint16 row vector 49 58 48 52 46 56 b = 1×8 uint16 row vector 48 58 49 58 48 52 46 56 a = '0:1:04.8' c = 45.5000 64.8000 a = 1×4 uint16 row vector 53 53 46 52 b = 1×8 uint16 row vector 48 58 48 58 53 53 46 52 a = '0:0:55.4' c = 45.5000 64.8000 55.4000 d = 55.2000 e = 9.7000 m = '55.2' s = '9.7'

2   Pass
x = {'1:38.4','2:12.9','2:00.6'}; y_correct = '1:57.3'; z_correct = '17.5'; [a,b]=mean_std(x); assert(isequal(a,y_correct)&isequal(b,z_correct))

a = 1×6 uint16 row vector 49 58 51 56 46 52 b = 1×8 uint16 row vector 48 58 49 58 51 56 46 52 a = '0:1:38.4' c = 98.4000 a = 1×6 uint16 row vector 50 58 49 50 46 57 b = 1×8 uint16 row vector 48 58 50 58 49 50 46 57 a = '0:2:12.9' c = 98.4000 132.9000 a = 1×6 uint16 row vector 50 58 48 48 46 54 b = 1×8 uint16 row vector 48 58 50 58 48 48 46 54 a = '0:2:00.6' c = 98.4000 132.9000 120.6000 d = 117.3000 e = 17.5000 f = 1 dLeft = 57.3000 g = '57.3' G = '1' m = '1:57.3' s = '17.5'

3   Pass
x = {'10:00.0','5:00.0','3:00.0','1:00.0'}; y_correct = '4:45.0'; z_correct = '3:51.7'; [a,b]=mean_std(x); assert(isequal(a,y_correct)&isequal(b,z_correct))

a = 1×7 uint16 row vector 49 48 58 48 48 46 48 b = 1×9 uint16 row vector 48 58 49 48 58 48 48 46 48 a = '0:10:00.0' c = 600 a = 1×6 uint16 row vector 53 58 48 48 46 48 b = 1×8 uint16 row vector 48 58 53 58 48 48 46 48 a = '0:5:00.0' c = 600 300 a = 1×6 uint16 row vector 51 58 48 48 46 48 b = 1×8 uint16 row vector 48 58 51 58 48 48 46 48 a = '0:3:00.0' c = 600 300 180 a = 1×6 uint16 row vector 49 58 48 48 46 48 b = 1×8 uint16 row vector 48 58 49 58 48 48 46 48 a = '0:1:00.0' c = 600 300 180 60 d = 285 e = 231.7000 f = 4 dLeft = 45 g = '45' G = '4' m = '4:45' m = '4:45.0' f = 3 dLeft = 51.7000 g = '51.7' G = '3' s = '3:51.7'

4   Pass
x = {'1:01.1','2:02.2','3:03.3','4:04.4'}; y_correct = '2:32.8'; z_correct = '1:18.9'; [a,b]=mean_std(x); assert(isequal(a,y_correct)&isequal(b,z_correct))

a = 1×6 uint16 row vector 49 58 48 49 46 49 b = 1×8 uint16 row vector 48 58 49 58 48 49 46 49 a = '0:1:01.1' c = 61.1000 a = 1×6 uint16 row vector 50 58 48 50 46 50 b = 1×8 uint16 row vector 48 58 50 58 48 50 46 50 a = '0:2:02.2' c = 61.1000 122.2000 a = 1×6 uint16 row vector 51 58 48 51 46 51 b = 1×8 uint16 row vector 48 58 51 58 48 51 46 51 a = '0:3:03.3' c = 61.1000 122.2000 183.3000 a = 1×6 uint16 row vector 52 58 48 52 46 52 b = 1×8 uint16 row vector 48 58 52 58 48 52 46 52 a = '0:4:04.4' c = 61.1000 122.2000 183.3000 244.4000 d = 152.8000 e = 78.9000 f = 2 dLeft = 32.8000 g = '32.8' G = '2' m = '2:32.8' f = 1 dLeft = 18.9000 g = '18.9' G = '1' s = '1:18.9'

5   Pass
x = {'50.7','1:02.3','59.4','57.3','1:00.4'}; y_correct = '58.0'; z_correct = '4.5'; [a,b]=mean_std(x); assert(isequal(a,y_correct)&isequal(b,z_correct))

a = 1×4 uint16 row vector 53 48 46 55 b = 1×8 uint16 row vector 48 58 48 58 53 48 46 55 a = '0:0:50.7' c = 50.7000 a = 1×6 uint16 row vector 49 58 48 50 46 51 b = 1×8 uint16 row vector 48 58 49 58 48 50 46 51 a = '0:1:02.3' c = 50.7000 62.3000 a = 1×4 uint16 row vector 53 57 46 52 b = 1×8 uint16 row vector 48 58 48 58 53 57 46 52 a = '0:0:59.4' c = 50.7000 62.3000 59.4000 a = 1×4 uint16 row vector 53 55 46 51 b = 1×8 uint16 row vector 48 58 48 58 53 55 46 51 a = '0:0:57.3' c = 50.7000 62.3000 59.4000 57.3000 a = 1×6 uint16 row vector 49 58 48 48 46 52 b = 1×8 uint16 row vector 48 58 49 58 48 48 46 52 a = '0:1:00.4' c = 50.7000 62.3000 59.4000 57.3000 60.4000 d = 58 e = 4.5000 m = '58' m = '58.0' s = '4.5'