Cody

# Problem 2407. Integer to boolean

Solution 2095977

Submitted on 17 Jan 2020 by Asif Newaz
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 = [1234; 23; 14; 12]; y_correct = [1 1 1 1; 0 1 1 0; 1 0 0 1; 1 1 0 0]; assert(isequal(integer2boolean(x),y_correct))

a = 4×4 char array '1234' ' 23' ' 14' ' 12' b = 16×1 char array '1' ' ' ' ' ' ' '2' ' ' ' ' ' ' '3' '2' '1' '1' '4' '3' '4' '2' c = '4' d = 4 a1 = 4 a2 = 4 y = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

2   Pass
x = [16; 14; 23; 26; 13; 46; 56]; y_correct = [1 0 0 0 0 1 1 0 0 1 0 0 0 1 1 0 0 0 0 1 0 0 0 1 1 0 1 0 0 0 0 0 0 1 0 1 0 0 0 0 1 1]; assert(isequal(integer2boolean(x),y_correct))

a = 7×2 char array '16' '14' '23' '26' '13' '46' '56' b = 14×1 char array '1' '1' '2' '2' '1' '4' '5' '6' '4' '3' '6' '3' '6' '6' c = '6' d = 6 a1 = 7 a2 = 2 y = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

3   Pass
x = [1234; 14; 13; 12; 34; 24]; y_correct = [1 1 1 1 1 0 0 1 1 0 1 0 1 1 0 0 0 0 1 1 0 1 0 1]; assert(isequal(integer2boolean(x),y_correct))

a = 6×4 char array '1234' ' 14' ' 13' ' 12' ' 34' ' 24' b = 24×1 char array '1' ' ' ' ' ' ' ' ' ' ' '2' ' ' ' ' ' ' ' ' ' ' '3' '1' '1' '1' '3' '2' '4' '4' '3' '2' '4' '4' c = '4' d = 4 a1 = 6 a2 = 4 y = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!