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

Learn moreOpportunities for recent engineering grads.

Apply TodayMake a vector of length *N* that consists of all zeros except at index *k*, where it has the value 1.

Example:

Input

N = 6; k = 2; vector = one_hot(N,k);

Output

vector = [0 1 0 0 0 0]

245 correct solutions
57 incorrect solutions

Last solution submitted on Jan 27, 2016

2 players like this problem

2 Comments