Cody

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

Solution 1563000

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

test_b = '1O1O1OOO11' test_b = '1010100011' b_mat = 1 0 1 0 1 0 0 0 1 1

Output argument "ans" (and maybe others) not assigned during call to "str2Binvec". Error in Test1 (line 3) binvec=str2Binvec(str);

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

test_b = 'OOOOO' test_b = '00000' b_mat = 0 0 0 0 0

Output argument "ans" (and maybe others) not assigned during call to "str2Binvec". Error in Test2 (line 3) binvec=str2Binvec(str);

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

test_b = '1O1OO1O1OOOOO11O11OO1OO11' test_b = '1010010100000110110010011' b_mat = 1 0 1 0 0 1 0 1 0 0 0 0 0 1 1 0 1 1 0 0 1 0 0 1 1

Output argument "ans" (and maybe others) not assigned during call to "str2Binvec". Error in Test3 (line 3) binvec=str2Binvec(str);