Cody

# Problem 1065. Make a 1 hot vector

Solution 1761815

Submitted on 26 Mar 2019
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
assert(isequal(one_hot(1,1),1))

Output argument "ans" (and maybe others) not assigned during call to "one_hot". Error in Test1 (line 1) assert(isequal(one_hot(1,1),1))

2   Fail
assert(isequal(one_hot(2,1),[1 0]))

Output argument "ans" (and maybe others) not assigned during call to "one_hot". Error in Test2 (line 1) assert(isequal(one_hot(2,1),[1 0]))

3   Fail
assert(isequal(one_hot(3,3),[0 0 1]))

Output argument "ans" (and maybe others) not assigned during call to "one_hot". Error in Test3 (line 1) assert(isequal(one_hot(3,3),[0 0 1]))

4   Fail
assert(isequal(one_hot(4,1),[1 0 0 0]))

Output argument "ans" (and maybe others) not assigned during call to "one_hot". Error in Test4 (line 1) assert(isequal(one_hot(4,1),[1 0 0 0]))

5   Fail
assert(isequal(one_hot(5,2),[0 1 0 0 0]))

Output argument "ans" (and maybe others) not assigned during call to "one_hot". Error in Test5 (line 1) assert(isequal(one_hot(5,2),[0 1 0 0 0]))

6   Fail
assert(isequal(one_hot(6,1),[1 0 0 0 0 0]))

Output argument "ans" (and maybe others) not assigned during call to "one_hot". Error in Test6 (line 1) assert(isequal(one_hot(6,1),[1 0 0 0 0 0]))

7   Fail
assert(isequal(one_hot(7,1),[1 0 0 0 0 0 0]))

Output argument "ans" (and maybe others) not assigned during call to "one_hot". Error in Test7 (line 1) assert(isequal(one_hot(7,1),[1 0 0 0 0 0 0]))

8   Fail
assert(isequal(one_hot(8,7),[0 0 0 0 0 0 1 0]))

Output argument "ans" (and maybe others) not assigned during call to "one_hot". Error in Test8 (line 1) assert(isequal(one_hot(8,7),[0 0 0 0 0 0 1 0]))

9   Fail
assert(isequal(one_hot(9,7),[0 0 0 0 0 0 1 0 0]))

Output argument "ans" (and maybe others) not assigned during call to "one_hot". Error in Test9 (line 1) assert(isequal(one_hot(9,7),[0 0 0 0 0 0 1 0 0]))

10   Fail
assert(isequal(one_hot(10,4),[0 0 0 1 0 0 0 0 0 0]))

Output argument "ans" (and maybe others) not assigned during call to "one_hot". Error in Test10 (line 1) assert(isequal(one_hot(10,4),[0 0 0 1 0 0 0 0 0 0]))

11   Fail
assert(isequal(one_hot(11,11),[0 0 0 0 0 0 0 0 0 0 1]))

Output argument "ans" (and maybe others) not assigned during call to "one_hot". Error in Test11 (line 1) assert(isequal(one_hot(11,11),[0 0 0 0 0 0 0 0 0 0 1]))

12   Fail
assert(isequal(one_hot(12,1),[1 0 0 0 0 0 0 0 0 0 0 0]))

Output argument "ans" (and maybe others) not assigned during call to "one_hot". Error in Test12 (line 1) assert(isequal(one_hot(12,1),[1 0 0 0 0 0 0 0 0 0 0 0]))

13   Fail
assert(isequal(one_hot(13,6),[0 0 0 0 0 1 0 0 0 0 0 0 0]))

Output argument "ans" (and maybe others) not assigned during call to "one_hot". Error in Test13 (line 1) assert(isequal(one_hot(13,6),[0 0 0 0 0 1 0 0 0 0 0 0 0]))

14   Fail
assert(isequal(one_hot(14,6),[0 0 0 0 0 1 0 0 0 0 0 0 0 0]))

Output argument "ans" (and maybe others) not assigned during call to "one_hot". Error in Test14 (line 1) assert(isequal(one_hot(14,6),[0 0 0 0 0 1 0 0 0 0 0 0 0 0]))

15   Fail
assert(isequal(one_hot(15,12),[0 0 0 0 0 0 0 0 0 0 0 1 0 0 0]))

Output argument "ans" (and maybe others) not assigned during call to "one_hot". Error in Test15 (line 1) assert(isequal(one_hot(15,12),[0 0 0 0 0 0 0 0 0 0 0 1 0 0 0]))

16   Fail
assert(isequal(one_hot(16,13),[0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0]))

Output argument "ans" (and maybe others) not assigned during call to "one_hot". Error in Test16 (line 1) assert(isequal(one_hot(16,13),[0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0]))

17   Fail
assert(isequal(one_hot(17,4),[0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0]))

Output argument "ans" (and maybe others) not assigned during call to "one_hot". Error in Test17 (line 1) assert(isequal(one_hot(17,4),[0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0]))

18   Fail
assert(isequal(one_hot(18,9),[0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0]))

Output argument "ans" (and maybe others) not assigned during call to "one_hot". Error in Test18 (line 1) assert(isequal(one_hot(18,9),[0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0]))

19   Fail
assert(isequal(one_hot(19,9),[0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0]))

Output argument "ans" (and maybe others) not assigned during call to "one_hot". Error in Test19 (line 1) assert(isequal(one_hot(19,9),[0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0]))

20   Fail
assert(isequal(one_hot(20,13),[0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0]))

Output argument "ans" (and maybe others) not assigned during call to "one_hot". Error in Test20 (line 1) assert(isequal(one_hot(20,13),[0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0]))