MATLAB: Hi,Is there anyone who could give an idea how to create a permutation vector permutation vectorvectors Like,every time the loop constructs,the vector would change. For example V1=[1 2 3 5 4]; V2=[2 3 1 5 4] and go on? Best Answer V1=[1 2 3 5 4]n=numel(V1)idx=randperm(n)V2=V1(idx) Related SolutionsMATLAB: Select unique couples from two vectors (?) v = [v1, v2];v = sort(v, 2);[uniquerows, idx] = unique(v, 'rows');uniquev1 = v1(idx);uniquev2 = v2(idx); MATLAB: Set vector elements of one vector to nonzero elements of another v1(logical(v2)) = v2(logical(v2));or on two lines:idx = logical(v2);v1(idx) = v2(idx); Related QuestionSum question in Matlab
Best Answer