Cody

Solution 2131277

Submitted on 17 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
numBit = 2; analogValue =1; binary=binaryCode(numBit,analogValue); binary_correct= '01'; assert(isequal(binary,binary_correct))

t = '10' t = '10' ans = 48 49

2   Pass
numBit = 4; analogValue =15; binary=binaryCode(numBit,analogValue); binary_correct= '1111'; assert(isequal(binary,binary_correct))

t = '11110' t = '1111' ans = 49 49 49 49

3   Pass
numBit = 6; analogValue =63; binary=binaryCode(numBit,analogValue); binary_correct= '111111'; assert(isequal(binary,binary_correct))

t = '1111110' t = '111111' ans = 49 49 49 49 49 49

Suggested Problems