Cody

# Problem 1466. Convert Two Character String into a Binary Vector

Solution 1460101

Submitted on 10 Mar 2018 by GEORGIOS BEKAS
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
expect_bin=randi(2,1,10)-1; str=char(9*expect_bin+79); binvec=str2Binvec(str); assert(isequal(expect_bin,binvec))

binvec1 = '11O1OO1O11' binvec1 = '1101001011' binvec = [] binvec = 1 binvec = 1 1 binvec = 1 1 0 binvec = 1 1 0 1 binvec = 1 1 0 1 0 binvec = 1 1 0 1 0 0 binvec = 1 1 0 1 0 0 1 binvec = 1 1 0 1 0 0 1 0 binvec = 1 1 0 1 0 0 1 0 1 binvec = 1 1 0 1 0 0 1 0 1 1

2   Pass
expect_bin=randi(2,1,5)-1; str=char(9*expect_bin+79); binvec=str2Binvec(str); assert(isequal(expect_bin,binvec))

binvec1 = '111OO' binvec1 = '11100' binvec = [] binvec = 1 binvec = 1 1 binvec = 1 1 1 binvec = 1 1 1 0 binvec = 1 1 1 0 0

3   Pass
expect_bin=randi(2,1,25)-1; str=char(9*expect_bin+79); binvec=str2Binvec(str); assert(isequal(expect_bin,binvec))

binvec1 = '11OOOO1111O1O1OOOOOOOOO11' binvec1 = '1100001111010100000000011' binvec = [] binvec = 1 binvec = 1 1 binvec = 1 1 0 binvec = 1 1 0 0 binvec = 1 1 0 0 0 binvec = 1 1 0 0 0 0 binvec = 1 1 0 0 0 0 1 binvec = 1 1 0 0 0 0 1 1 binvec = 1 1 0 0 0 0 1 1 1 binvec = 1 1 0 0 0 0 1 1 1 1 binvec = 1 1 0 0 0 0 1 1 1 1 0 binvec = 1 1 0 0 0 0 1 1 1 1 0 1 binvec = 1 1 0 0 0 0 1 1 1 1 0 1 0 binvec = 1 1 0 0 0 0 1 1 1 1 0 1 0 1 binvec = 1 1 0 0 0 0 1 1 1 1 0 1 0 1 0 binvec = 1 1 0 0 0 0 1 1 1 1 0 1 0 1 0 0 binvec = 1 1 0 0 0 0 1 1 1 1 0 1 0 1 0 0 0 binvec = 1 1 0 0 0 0 1 1 1 1 0 1 0 1 0 0 0 0 binvec = 1 1 0 0 0 0 1 1 1 1 0 1 0 1 0 0 0 0 0 binvec = 1 1 0 0 0 0 1 1 1 1 0 1 0 1 0 0 0 0 0 0 binvec = 1 1 0 0 0 0 1 1 1 1 0 1 0 1 0 0 0 0 0 0 0 binvec = 1 1 0 0 0 0 1 1 1 1 0 1 0 1 0 0 0 0 0 0 0 0 binvec = 1 1 0 0 0 0 1 1 1 1 0 1 0 1 0 0 0 0 0 0 0 0 0 binvec = 1 1 0 0 0 0 1 1 1 1 0 1 0 1 0 0 0 0 0 0 0 0 0 1 binvec = 1 1 0 0 0 0 1 1 1 1 0 1 0 1 0 0 0 0 0 0 0 0 0 1 1