This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.
Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
x = 2015;
y_correct=[1,1,1,1,1,0,1,1,1,1,1];
assert(isequal(dectobin(x),y_correct))
temp =
'11111011111'
temp2 =
1.1111e+10
rem =
1
temp2 =
1.1111e+09
z =
1
i =
2
rem =
1
temp2 =
111110111
z =
1 1
i =
3
rem =
1
temp2 =
11111011
z =
1 1 1
i =
4
rem =
1
temp2 =
1111101
z =
1 1 1 1
i =
5
rem =
1
temp2 =
111110
z =
1 1 1 1 1
i =
6
rem =
0
temp2 =
11111
z =
1 1 1 1 1 0
i =
7
rem =
1
temp2 =
1111
z =
1 1 1 1 1 0 1
i =
8
rem =
1
temp2 =
111
z =
1 1 1 1 1 0 1 1
i =
9
rem =
1
temp2 =
11
z =
1 1 1 1 1 0 1 1 1
i =
10
rem =
1
temp2 =
1
z =
1 1 1 1 1 0 1 1 1 1
i =
11
rem =
1
temp2 =
0
z =
1 1 1 1 1 0 1 1 1 1 1
i =
12
y =
1 1 1 1 1 0 1 1 1 1 1
|
2 | Pass |
x = 13;
y_correct=[1,1,0,1];
assert(isequal(dectobin(x),y_correct))
temp =
'1101'
temp2 =
1101
rem =
1
temp2 =
110
z =
1
i =
2
rem =
0
temp2 =
11
z =
1 0
i =
3
rem =
1
temp2 =
1
z =
1 0 1
i =
4
rem =
1
temp2 =
0
z =
1 0 1 1
i =
5
y =
1 1 0 1
|
3 | Pass |
x = 143;
y_correct=[1,0,0,0,1,1,1,1];
assert(isequal(dectobin(x),y_correct))
temp =
'10001111'
temp2 =
10001111
rem =
1
temp2 =
1000111
z =
1
i =
2
rem =
1
temp2 =
100011
z =
1 1
i =
3
rem =
1
temp2 =
10001
z =
1 1 1
i =
4
rem =
1
temp2 =
1000
z =
1 1 1 1
i =
5
rem =
0
temp2 =
100
z =
1 1 1 1 0
i =
6
rem =
0
temp2 =
10
z =
1 1 1 1 0 0
i =
7
rem =
0
temp2 =
1
z =
1 1 1 1 0 0 0
i =
8
rem =
1
temp2 =
0
z =
1 1 1 1 0 0 0 1
i =
9
y =
1 0 0 0 1 1 1 1
|
54227 Solvers
819 Solvers
404 Solvers
641 Solvers
Matlab Basics - Convert a row vector to a column vector
419 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!