Cody

Solution 2127176

Submitted on 13 Feb 2020 by Jiahang Li
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 = [1.000 1.04 0.22 10.1; 2.05 2.33 4.1 1000.31; 5.00010 6.429 7.492 8.0]; y_correct = 4; assert(isequal(find_max_sigdec(x),y_correct))

q = 1×10 cell array {'.04'} {'.22'} {'.1'} {'.05'} {'.33'} {'.1'} {'.31'} {'.0001'} {'.429'} {'.492'} s = 3 s = 3 3 s = 3 3 2 s = 3 3 2 3 s = 3 3 2 3 3 s = 3 3 2 3 3 2 s = 3 3 2 3 3 2 3 s = 3 3 2 3 3 2 3 5 s = 3 3 2 3 3 2 3 5 4 s = 3 3 2 3 3 2 3 5 4 4 ans = 4

2   Pass
N = randi(6,1); x1 = rand(1,100); for k = 1:100 x(1,k) = round(x1(1,k)*10^N)/10^N; end assert(isequal(find_max_sigdec(x), N))

q = 1×100 cell array Columns 1 through 16 {'.17'} {'.64'} {'.15'} {'.7'} {'.1'} {'.86'} {'.75'} {'.72'} {'.37'} {'.55'} {'.66'} {'.54'} {'.01'} {'.69'} {'.29'} {'.24'} Columns 17 through 32 {'.66'} {'.9'} {'.3'} {'.45'} {'.44'} {'.52'} {'.27'} {'.35'} {'.71'} {'.65'} {'.28'} {'.25'} {'.07'} {'.84'} {'.86'} {'.01'} Columns 33 through 48 {'.19'} {'.06'} {'.28'} {'.33'} {'.18'} {'.87'} {'.62'} {'.07'} {'.8'} {'.17'} {'.53'} {'.19'} {'.36'} {'.08'} {'.27'} {'.34'} Columns 49 through 64 {'.96'} {'.71'} {'.26'} {'.52'} {'.17'} {'.81'} {'.84'} {'.82'} {'.43'} {'.01'} {'.43'} {'.33'} {'.44'} {'.81'} {'.01'} {'.97'} Columns 65 through 80 {'.72'} {'.06'} {'.54'} {'.55'} {'.67'} {'.22'} {'.82'} {'.18'} {'.89'} {'.86'} {'.01'} {'.2'} {'.9'} {'.32'} {'.84'} {'.1'} Columns 81 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3 3 3 s = 3 3 3 2 2 3 3 3 3 3 3 3 3 3 3 3 3 2 2 3 3 3 3 3 3 3 3 3 3 s = Columns 1 through 29 3 3 3 2 2 3 3 3 3 3 3 3 3 3 3 3 3 2 2 3 3 3 3 3 3 3 3 3 3 Column 30 3 s = Columns 1 through 29 3 3 3 2 2 3 3 3 3 3 3 3 3 3 3 3 3 2 2 3 3 3 3 3 3 3 3 3 3 Columns 30 through 31 3 3 s = Columns 1 through 29 3 3 3 2 2 3 3 3 3 3 3 3 3 3 3 3 3 2 2 3 3 3 3 3 3 3 3 3 3 Columns 30 through 32 3 3 3 s = Columns 1 through 29 3 3 3 2 2 3 3 3 3 3 3 3 3 3 3 3 3 2 2 3 3 3 3 3 3 3 3 3 3 Columns 30 through 33 3 3 3 3 s = Columns 1 through 29 3 3 3 2 2 3 3 3 3 3 3 3 3 3 3 3 3 2 2 3 3 3 3 3 3 3 3 3 3 Columns 30 through 34 3 3 3 3 3 s = Columns 1 through 29 3 3 3 2 2 3 3 3 3 3 3 3 3 3 3 3 3 2 2 3 3 3 3 3 3 3 3 3 3 Columns 30 through 35 3 3 3 3 3 3 s = Columns 1 through 29 3 3 3 2 2 3 3 3 3 3 3 3 3 3 3 3 3 2 2 3 3 3 3 3 3 3 3 3 3 Columns 30 through 36 3 3 3 3 3 3 3 s = Columns 1 through 29 3 3 3 2 2 3 3 3 3 3 3 3 3 3 3 3 3 2 2 3 3 3 3 3 3 3 3 3 3 Columns 30 through 37 3 3 3 3 3 3 3 3 s = Columns 1 through 29 3 3 3 2 2 3 3 3 3 3 3 3 3 3 3 3 3 2 2 3 3 3 3 3 3 3 3 3 3 Columns 30 through 38 3 3 3 3 3 3 3 3 3 s = Columns 1 through 29 3 3 3 2 2 3 3 3 3 3 3 3 3 3 3 3 3 2 2 3 3 3 3 3 3 3 3 3 3 Columns 30 through 39 3 3 3 3 3 3 3 3 3 3 s = Columns 1 through 29 3 3 3 2 2 3 3 3 3 3 3 3 3 3 3 3 3 2 2 3 3 3 3 3 3 3 3 3 3 Columns 30 through 40 3 3 3 3 3 3 3 3 3 3 3 s = Columns 1 through 29 3 3 3 2 2 3 3 3 3 3 3 3 3 3 3 3 3 2 2 3 3 3 3 3 3 3 3 3 3 Columns 30 through 41 3 3 3 3 3 3 3 3 3 3 3 2 s = Columns 1 through 29 3 3 3 2 2 3 3 3 3 3 3 3 3 3 3 3 3 2 2 3 3 3 3 3 3 3 3 3 3 Columns 30 through 42 3 3 3 3 3 3 3 3 3 3 3 2 3 s = Columns 1 through 29 3 3 3 2 2 3 3 3 3 3 3 3 3 3 3 3 3 2 2 3 3 3 3 3 3 3 3 3 3 Columns 30 through 43 3 3 3 3 3 3 3 3 3 3 3 2 3 3 s = Columns 1 through 29 3 3 3 2 2 3 3 3 3 3 3 3 3 3 3 3 3 2 2 3 3 3 3 3 3 3 3 3 3 Columns 30 through 44 3 3 3 3 3 3 3 3 3 3 3 2 3 3 3 s = Columns 1 through 29 3 3 3 2 2 3 3 3 3 3 3 3 3 3 3 3 3 2 2 3 3 3 3 3 3 3 3 3 3 Columns 30 through 45 3 3 3 3 3 3 3 3 3 3 3 2 3 3 3 3 s = Columns 1 through 29 3 3 3 2 2 3 3 3 3 3 3 3 3 3 3 3 3 2 2 3 3 3 3 3 3 3 3 3 3 Columns 30 through 46 3 3 3 3 3 3 3 3 3 3 3 2 3 3 3 3 3 s = Columns 1 through 29 3 3 3 2 2 3 3 3 3 3 3 3 3 3 3 3 3 2 2 3 3 3 3 3 3 3 3 3 3 Columns 30 through 47 3 3 3 3 3 3 3 3 3 3 3 2 3 3 3 3 3 3 s = Columns 1 through 29 3 3 3 2 2 3 3 3 3 3 3 3 3 3 3 3 3 2 2 3 3 3 3 3 3 3 3 3 3 Columns 30 through 48 3 3 3 3 3 3 3 3 3 3 3 2 3 3 3 3 3 3 3 s = Columns 1 through 29 3 3 3 2 2 3 3 3 3 3 3 3 3 3 3 3 3 2 2 3 3 3 3 3 3 3 3 3 3 Columns 30 through 49 3 3 3 3 3 3 3 3 3 3 3 ...

3   Pass
N = randi(6,1); a = rand(5,20); for k = 1:20 for m = 1:5 x(m,k) = round(a(m,k)*10^N)/10^N; end end assert(isequal(find_max_sigdec(x), N))

q = 1×100 cell array Columns 1 through 16 {'.96'} {'.88'} {'.93'} {'.42'} {'.08'} {'.5'} {'.54'} {'.86'} {'.45'} {'.14'} {'.76'} {'.04'} {'.16'} {'.24'} {'.56'} {'.26'} Columns 17 through 32 {'.26'} {'.09'} {'.74'} {'.25'} {'.84'} {'.1'} {'.26'} {'.3'} {'.95'} {'.39'} {'.25'} {'.85'} {'.67'} {'.11'} {'.72'} {'.13'} Columns 33 through 48 {'.58'} {'.14'} {'.49'} {'.66'} {'.71'} {'.52'} {'.82'} {'.88'} {'.71'} {'.75'} {'.56'} {'.71'} {'.08'} {'.61'} {'.36'} {'.86'} Columns 49 through 64 {'.11'} {'.36'} {'.61'} {'.23'} {'.68'} {'.88'} {'.95'} {'.2'} {'.43'} {'.55'} {'.28'} {'.17'} {'.96'} {'.78'} {'.61'} {'.35'} Columns 65 through 80 {'.8'} {'.58'} {'.93'} {'.61'} {'.88'} {'.62'} {'.86'} {'.88'} {'.16'} {'.37'} {'.21'} {'.3'} {'.7'} {'.26'} {'.9'} {'.67'} Columns 81 through 96 {'.22'} {'.02'} {'.3'} {'.86'} {'.61'} {'.86'} {'.6'} {'.77'} {'.87'} {'.26'} {'.58'} {'.24'} {'.56'} {'.03'} {'.16'} {'.66'} Columns 97 through 100 {'.09'} {'.36'} {'.67'} {'.44'} s = 3 s = 3 3 s = 3 3 3 s = 3 3 3 3 s = 3 3 3 3 3 s = 3 3 3 3 3 2 s = 3 3 3 3 3 2 3 s = 3 3 3 3 3 2 3 3 s = 3 3 3 3 3 2 3 3 3 s = 3 3 3 3 3 2 3 3 3 3 s = 3 3 3 3 3 2 3 3 3 3 3 s = 3 3 3 3 3 2 3 3 3 3 3 3 s = 3 3 3 3 3 2 3 3 3 3 3 3 3 s = 3 3 3 3 3 2 3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 2 3 3 3 3 3 Columns 30 through 33 3 3 3 3 s = Columns 1 through 29 3 3 3 3 3 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 3 2 3 3 3 3 3 Columns 30 through 34 3 3 3 3 3 s = Columns 1 through 29 3 3 3 3 3 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 3 2 3 3 3 3 3 Columns 30 through 35 3 3 3 3 3 3 s = Columns 1 through 29 3 3 3 3 3 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 3 2 3 3 3 3 3 Columns 30 through 36 3 3 3 3 3 3 3 s = Columns 1 through 29 3 3 3 3 3 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 3 2 3 3 3 3 3 Columns 30 through 37 3 3 3 3 3 3 3 3 s = Columns 1 through 29 3 3 3 3 3 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 3 2 3 3 3 3 3 Columns 30 through 38 3 3 3 3 3 3 3 3 3 s = Columns 1 through 29 3 3 3 3 3 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 3 2 3 3 3 3 3 Columns 30 through 39 3 3 3 3 3 3 3 3 3 3 s = Columns 1 through 29 3 3 3 3 3 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 3 2 3 3 3 3 3 Columns 30 through 40 3 3 3 3 3 3 3 3 3 3 3 s = Columns 1 through 29 3 3 3 3 3 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 3 2 3 3 3 3 3 Columns 30 through 41 3 3 3 3 3 3 3 3 3 3 3 3 s = Columns 1 through 29 3 3 3 3 3 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 3 2 3 3 3 3 3 Columns 30 through 42 3 3 3 3 3 3 3 3 3 3 3 3 3 s = Columns 1 through 29 3 3 3 3 3 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 3 2 3 3 3 3 3 Columns 30 through 43 3 3 3 3 3 3 3 3 3 3 3 3 3 3 s = Columns 1 through 29 3 3 3 3 3 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 3 2 3 3 3 3 3 Columns 30 through 44 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 s = Columns 1 through 29 3 3 3 3 3 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 3 2 3 3 3 3 3 Columns 30 through 45 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 s = Columns 1 through 29 3 3 3 3 3 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 3 2 3 3 3 3 3 Columns 30 through 46 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 s = Columns 1 through 29 3 3 3 3 3 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 3 2 3 3 3 3 3 Columns 30 through 47 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 s = Columns 1 through 29 3 3 3 3 3 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 3 2 3 3 3 3 3 Columns 30 through 48 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 s = Columns 1 through 29 3 3 3 3 3 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 3 2 3 3 3 3 3 Columns 30 through 49 3 3 3 3 3 3 3 3 3 3 3 ...

4   Pass
x = 1; assert(isequal(find_max_sigdec(x), 0))

q = 0×0 empty cell array ans = 0

Suggested Problems