Hi, suppose N is a scalar, and c is a numerical vector with unique elements that are a subset of 1:N, i.e. its size is smaller or equal to N. For example, N=4, and c=[1 2 4]'; Then, is there a more elegant way to achieve this?
cc = [];for j = 1:N if ismember(j,c) cc = [cc; N*(j-1)+c]; endend
Thanks!
Best Answer