Cody

Solution 2127172

Submitted on 13 Feb 2020
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 12 {'.90532'} {'.19985'} {'.31903'} {'.00224'} {'.96114'} {'.50767'} {'.27232'} {'.23432'} {'.69047'} {'.94567'} {'.28231'} {'.32007'} Columns 13 through 25 {'.88467'} {'.8255'} {'.05483'} {'.53334'} {'.10094'} {'.55699'} {'.25258'} {'.9211'} {'.89921'} {'.99705'} {'.00024'} {'.78753'} {'.23043'} Columns 26 through 38 {'.04435'} {'.27764'} {'.91737'} {'.83803'} {'.91593'} {'.2662'} {'.65561'} {'.03096'} {'.3482'} {'.19124'} {'.80326'} {'.83211'} {'.49993'} Columns 39 through 51 {'.84896'} {'.17007'} {'.59222'} {'.53241'} {'.02633'} {'.82133'} {'.3309'} {'.56579'} {'.0175'} {'.12174'} {'.49209'} {'.65217'} {'.467'} Columns 52 through 64 {'.19815'} {'.57188'} {'.70678'} {'.27275'} {'.15784'} {'.21012'} {'.07184'} {'.09869'} {'.7679'} {'.09795'} {'.08456'} {'.80782'} {'.91671'} Columns 65 through 77 {'.97757'} {'.5079'} {'.45907'} {'.58403'} {'.75581'} {'.44556'} {'.1726'} {'.11282'} {'.98772'} {'.42895'} {'.88307'} {'.00862'} {'.76848'} Columns 78 through 90 {'.95039'} {'.29561'} {'.58583'} {'.23469'} {'.87121'} {'.85073'} {'.7281'} {'.77861'} {'.48949'} {'.25657'} {'.47289'} {'.26674'} {'.34899'} Columns 91 through 100 {'.79222'} {'.26311'} {'.74331'} {'.08045'} {'.11797'} {'.18835'} {'.81392'} {'.78092'} {'.08793'} {'.39583'} s = 6 s = 6 6 s = 6 6 6 s = 6 6 6 6 s = 6 6 6 6 6 s = 6 6 6 6 6 6 s = 6 6 6 6 6 6 6 s = 6 6 6 6 6 6 6 6 s = 6 6 6 6 6 6 6 6 6 s = 6 6 6 6 6 6 6 6 6 6 s = 6 6 6 6 6 6 6 6 6 6 6 s = 6 6 6 6 6 6 6 6 6 6 6 6 s = 6 6 6 6 6 6 6 6 6 6 6 6 6 s = 6 6 6 6 6 6 6 6 6 6 6 6 6 5 s = 6 6 6 6 6 6 6 6 6 6 6 6 6 5 6 s = 6 6 6 6 6 6 6 6 6 6 6 6 6 5 6 6 s = 6 6 6 6 6 6 6 6 6 6 6 6 6 5 6 6 6 s = 6 6 6 6 6 6 6 6 6 6 6 6 6 5 6 6 6 6 s = 6 6 6 6 6 6 6 6 6 6 6 6 6 5 6 6 6 6 6 s = 6 6 6 6 6 6 6 6 6 6 6 6 6 5 6 6 6 6 6 5 s = 6 6 6 6 6 6 6 6 6 6 6 6 6 5 6 6 6 6 6 5 6 s = 6 6 6 6 6 6 6 6 6 6 6 6 6 5 6 6 6 6 6 5 6 6 s = 6 6 6 6 6 6 6 6 6 6 6 6 6 5 6 6 6 6 6 5 6 6 6 s = 6 6 6 6 6 6 6 6 6 6 6 6 6 5 6 6 6 6 6 5 6 6 6 6 s = 6 6 6 6 6 6 6 6 6 6 6 6 6 5 6 6 6 6 6 5 6 6 6 6 6 s = 6 6 6 6 6 6 6 6 6 6 6 6 6 5 6 6 6 6 6 5 6 6 6 6 6 6 s = 6 6 6 6 6 6 6 6 6 6 6 6 6 5 6 6 6 6 6 5 6 6 6 6 6 6 6 s = 6 6 6 6 6 6 6 6 6 6 6 6 6 5 6 6 6 6 6 5 6 6 6 6 6 6 6 6 s = 6 6 6 6 6 6 6 6 6 6 6 6 6 5 6 6 6 6 6 5 6 6 6 6 6 6 6 6 6 s = 6 6 6 6 6 6 6 6 6 6 6 6 6 5 6 6 6 6 6 5 6 6 6 6 6 6 6 6 6 6 s = Columns 1 through 30 6 6 6 6 6 6 6 6 6 6 6 6 6 5 6 6 6 6 6 5 6 6 6 6 6 6 6 6 6 6 Column 31 5 s = Columns 1 through 30 6 6 6 6 6 6 6 6 6 6 6 6 6 5 6 6 6 6 6 5 6 6 6 6 6 6 6 6 6 6 Columns 31 through 32 5 6 s = Columns 1 through 30 6 6 6 6 6 6 6 6 6 6 6 6 6 5 6 6 6 6 6 5 6 6 6 6 6 6 6 6 6 6 Columns 31 through 33 5 6 6 s = Columns 1 through 30 6 6 6 6 6 6 6 6 6 6 6 6 6 5 6 6 6 6 6 5 6 6 6 6 6 6 6 6 6 6 Columns 31 through 34 5 6 6 5 s = Columns 1 through 30 6 6 6 6 6 6 6 6 6 6 6 6 6 5 6 6 6 6 6 5 6 6 6 6 6 6 6 6 6 6 Columns 31 through 35 5 6 6 5 6 s = Columns 1 through 30 6 6 6 6 6 6 6 6 6 6 6 6 6 5 6 6 6 6 6 5 6 6 6 6 6 6 6 6 6 6 Columns 31 through 36 5 6 6 5 6 6 s = Columns 1 through 30 6 6 6 6 6 6 6 6 6 6 6 6 6 5 6 6 6 6 6 5 6 6 6 6 6 6 6 6 6 6 Columns 31 through 37 5 6 6 5 6 6 6 s = Columns 1 through 30 6 6 6 6 6 6 6 6 6 6 6 6 6 5 6 6 6 6 6 5 6 6 6 6 6 6 6 6 6 6 Columns 31 through 38 5 6 6 5 6 6 6 6 s = Columns 1 through 30 6 6 6 6 6 6 6 6 6 6 6 6 6 5 6 6 6 6 6 5 6 6 6 6 6 6 6 6 6 6 Columns 31 through 39 5 6 6 5 6 6 6 6 6 s = Columns 1 through 30 6 6 6 6 6 6 6 6 6 6 6 6 6 5 6 6 6 6 6 5 6 6 6 6 6 6 6 6 6 6 Columns 31 through 40 5 6 6 5 6 6 6 6 6 6 s = Columns 1 through 30 6 6 6 6 6 6 6 6 6 6 6 6 6 5 6 6 6 6 6 5 6 6 6 6 6 6 6 6 6 6 Columns 31 through 41 5 6 6 5 6 6 6 6 6 6 6 s = Columns 1 through 30 6 6 6 6 6 6 6 6 6 6 6 6 6 5 6 6 6 6 6 5 6 6 6 6 6 6 6 6 6 6 Columns 31 through 42 5 6 6 5 6 6 6 6 6 6 6 6 s = Columns 1 through 30 6 6 6 6 6 6 6 6 6 6 6 6 6 5 6 6 6 6 6 5 6 6 6 6 6 6 6 6 6 6 Columns 31 through 43 5 6 6 5 6 6 6 6 6 6 6 6 6 s = Columns 1 through 30 6 6 6 6 6 6 6 6 6 6 6 6 6 5 6 6 6 6 6 5 6 6 6 6 6 6 6 6 6 6 Columns 31 through 44 5 6 6 5 6 6 6 6 6 6 6 6 6 6 s = Columns 1 through 30 6 6 6 6 6 6 6 6 6 6 6 6 6 5 6 6 6 6 6 5 6 6 6 6 6 6 6 6 6 6 Columns 31 through 45 5 6 6 5 6 6 6 6 6 6 6 6 6 6 5 s = Columns 1 through 30 6 6 6 6 6 6 6 6 6 6 6 6 6 5 6 6 6 6 6 5 6 6 6 6 6 6 6 6 6 6 Columns 31 through 46 5 6 6 5 6 6 6 6 6 6 6 6 6 6 5 6 s = Columns 1 through 30 6 6 6 6 6 6 6 6 6 6 6 6 6 5 6 6 6 6 6 5 6 6 6 6 6 6 6 6 6 6 Columns 31 through 47 5 6 6 5 6 6 6 6 6 6 6 6 6 6 5 6 5 s = Columns 1 through 30 6 6 6 6 6 6 6 6 6 6 6 6 6 5 6 6 6 6 6 5 6 6 6 6 6 6 6 6 6 6 Columns 31 through 48 5 6 6 5 6 6 6 6 6 6 6 6 6 6 5 6 5 6 s = Columns 1 through...

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 13 {'.27564'} {'.07039'} {'.5055'} {'.82851'} {'.68276'} {'.67825'} {'.89359'} {'.30755'} {'.72645'} {'.41708'} {'.01823'} {'.76732'} {'.8033'} Columns 14 through 26 {'.13789'} {'.39083'} {'.57543'} {'.15069'} {'.87236'} {'.87421'} {'.5816'} {'.5665'} {'.60753'} {'.15526'} {'.39887'} {'.42119'} {'.90264'} Columns 27 through 38 {'.49225'} {'.17775'} {'.03255'} {'.40514'} {'.25061'} {'.62892'} {'.99143'} {'.04678'} {'.93396'} {'.23911'} {'.06684'} {'.99267'} Columns 39 through 51 {'.24634'} {'.38672'} {'.61617'} {'.80083'} {'.582'} {'.49878'} {'.28666'} {'.17398'} {'.3414'} {'.34254'} {'.14779'} {'.90273'} {'.56565'} Columns 52 through 64 {'.97393'} {'.16887'} {'.71064'} {'.1086'} {'.45251'} {'.50228'} {'.96518'} {'.06038'} {'.38167'} {'.7709'} {'.28894'} {'.66551'} {'.26611'} Columns 65 through 76 {'.57583'} {'.74364'} {'.10766'} {'.06517'} {'.76974'} {'.97465'} {'.89322'} {'.38301'} {'.68616'} {'.17784'} {'.11026'} {'.56423'} Columns 77 through 89 {'.81933'} {'.7332'} {'.5569'} {'.69907'} {'.55628'} {'.03562'} {'.02915'} {'.13779'} {'.50526'} {'.8024'} {'.04191'} {'.9525'} {'.76833'} Columns 90 through 100 {'.32002'} {'.64427'} {'.00475'} {'.80046'} {'.58928'} {'.79008'} {'.51625'} {'.37366'} {'.59985'} {'.93632'} {'.58759'} s = 6 s = 6 6 s = 6 6 5 s = 6 6 5 6 s = 6 6 5 6 6 s = 6 6 5 6 6 6 s = 6 6 5 6 6 6 6 s = 6 6 5 6 6 6 6 6 s = 6 6 5 6 6 6 6 6 6 s = 6 6 5 6 6 6 6 6 6 6 s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6 6 6 Columns 31 through 32 6 6 s = Columns 1 through 30 6 6 5 6 6 6 6 6 6 6 6 6 5 6 6 6 6 6 6 5 5 6 6 6 6 6 6 6 6 6 Columns 31 through 33 6 6 6 s = Columns 1 through 30 6 6 5 6 6 6 6 6 6 6 6 6 5 6 6 6 6 6 6 5 5 6 6 6 6 6 6 6 6 6 Columns 31 through 34 6 6 6 6 s = Columns 1 through 30 6 6 5 6 6 6 6 6 6 6 6 6 5 6 6 6 6 6 6 5 5 6 6 6 6 6 6 6 6 6 Columns 31 through 35 6 6 6 6 6 s = Columns 1 through 30 6 6 5 6 6 6 6 6 6 6 6 6 5 6 6 6 6 6 6 5 5 6 6 6 6 6 6 6 6 6 Columns 31 through 36 6 6 6 6 6 6 s = Columns 1 through 30 6 6 5 6 6 6 6 6 6 6 6 6 5 6 6 6 6 6 6 5 5 6 6 6 6 6 6 6 6 6 Columns 31 through 37 6 6 6 6 6 6 6 s = Columns 1 through 30 6 6 5 6 6 6 6 6 6 6 6 6 5 6 6 6 6 6 6 5 5 6 6 6 6 6 6 6 6 6 Columns 31 through 38 6 6 6 6 6 6 6 6 s = Columns 1 through 30 6 6 5 6 6 6 6 6 6 6 6 6 5 6 6 6 6 6 6 5 5 6 6 6 6 6 6 6 6 6 Columns 31 through 39 6 6 6 6 6 6 6 6 6 s = Columns 1 through 30 6 6 5 6 6 6 6 6 6 6 6 6 5 6 6 6 6 6 6 5 5 6 6 6 6 6 6 6 6 6 Columns 31 through 40 6 6 6 6 6 6 6 6 6 6 s = Columns 1 through 30 6 6 5 6 6 6 6 6 6 6 6 6 5 6 6 6 6 6 6 5 5 6 6 6 6 6 6 6 6 6 Columns 31 through 41 6 6 6 6 6 6 6 6 6 6 6 s = Columns 1 through 30 6 6 5 6 6 6 6 6 6 6 6 6 5 6 6 6 6 6 6 5 5 6 6 6 6 6 6 6 6 6 Columns 31 through 42 6 6 6 6 6 6 6 6 6 6 6 6 s = Columns 1 through 30 6 6 5 6 6 6 6 6 6 6 6 6 5 6 6 6 6 6 6 5 5 6 6 6 6 6 6 6 6 6 Columns 31 through 43 6 6 6 6 6 6 6 6 6 6 6 6 4 s = Columns 1 through 30 6 6 5 6 6 6 6 6 6 6 6 6 5 6 6 6 6 6 6 5 5 6 6 6 6 6 6 6 6 6 Columns 31 through 44 6 6 6 6 6 6 6 6 6 6 6 6 4 6 s = Columns 1 through 30 6 6 5 6 6 6 6 6 6 6 6 6 5 6 6 6 6 6 6 5 5 6 6 6 6 6 6 6 6 6 Columns 31 through 45 6 6 6 6 6 6 6 6 6 6 6 6 4 6 6 s = Columns 1 through 30 6 6 5 6 6 6 6 6 6 6 6 6 5 6 6 6 6 6 6 5 5 6 6 6 6 6 6 6 6 6 Columns 31 through 46 6 6 6 6 6 6 6 6 6 6 6 6 4 6 6 6 s = Columns 1 through 30 6 6 5 6 6 6 6 6 6 6 6 6 5 6 6 6 6 6 6 5 5 6 6 6 6 6 6 6 6 6 Columns 31 through 47 6 6 6 6 6 6 6 6 6 6 6 6 4 6 6 6 5 s = Columns 1 through 30 6 6 5 6 6 6 6 6 6 6 6 6 5 6 6 6 6 6 6 5 5 6 6 6 6 6 6 6 6 6 Columns 31 through 48 6 6 6 6 6 6 6 6 6 6 6 6 4 6 6 6 5 6 s = Columns 1 through ...

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

q = 0×0 empty cell array

Unrecognized function or variable 's'. Error in find_max_sigdec (line 6) max(s)-1 Error in Test4 (line 2) assert(isequal(find_max_sigdec(x), 0))