MATLAB: Finding multiple first or last indicies findindexing How can you index the first or last values in a column: x = [1;1;1;0;0;1;1;0;1;0;0;1] find the first instances of the 1's: index1=[1,6,9,12] find the last instances of 0's: index0 = [5,8,11] Best Answer x = [1;1;1;0;0;1;1;0;1;0;0;1]s = [0, x.'];result1 = strfind(s, [0, 1])result2 = result1(2:end) - 1 Related SolutionsMATLAB: Hi All, can someone please help me with this… A = [ 1 1 1 1 1 0 1 1 0 0 0 0 1 1 1 1 0 0 0 0 ];ind = findstr(A,[0 0])ind = 9 10 11 17 18 19So the FIRST instance occurs atind(1) + [0 1]ans = 9 10 MATLAB: Find the index of the rows that have all 1 idx=find(all(A,2)) Related QuestionNeed 3rd dimension indicies for calling values.Find first value and repalce values following itHow to loop on multiple indiciesFind all occuarances of two numbers togetherHow to pull out indicies from a matrixThe first time there is zero before and after a particular indexHow to assign indicies of a function imput vector
Best Answer