This code is to cut random values from the vector ch and create new vector a. Then, insert a into ch after delete a selected values from ch
What I should change, to be the result like this:
for example if a = [8; 4; 9], then the result :
ch = 5 8 4 9 6 7 Matlab code:
ch = [4; 5; 6; 7; 8; 9]; for i = 1:3 g = randi(3); a(i) = ch(g); ch(g) = []; end; startIdx = 2; finalIdx = startIdx + size(a,1) - 1; ch(startIdx:finalIdx) = a; disp (ch);