Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Solution 238924

Submitted on 2 May 2013 by G K

Correct

10Size
Leading solution size is 10.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test
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))

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

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