MATLAB: Adding values in array index Hi suppose I have two variable idx1= 1 2 3 idx2= 4 5 I need to have a third variable idx3 where idx3= 1 2 3 4 5 NB. idx1 and idx2 are linear indices and idx3 is the indices having all idx1 and idx2 Best Answer If idx1 and idx2 are row vectors you can doidx3 = [idx1 idx2];If they are column vectors doidx3 = [idx1; idx2]; Related SolutionsMATLAB: Replace an array with another array A(32:41) = B MATLAB: Detect parts of a 0/1 (binary) vector consisting of only 0 or 1 idx = find(diff([~a(1) a]))';pcs = spdiags(rot90([idx-1 idx]));pcs(end) = numel(a) Related QuestionHow to index a sorted array with the actual arrayIterations on field conditions of a structure arraySearch an array and find the row and column number of a certain elementTaking difference of adjecent elements by seting a custom order
Best Answer