A =[ 0 0 3 3 3 0 0 3 0 0; 0 0 0 3 3 3 0 3 3 0][rows,colms ] = size(A)for i = 1:rows for j = 1:colms index-1 = find(A==3,1,'first') index_2 = find(A==3,1,'last') If A(i,j)=3 & A(i,j)==index_1 A(i,index_1:index_2) = A(i,index_1:index_2) +1 end end end
it gives me 5th and 18th indices while i want to get row wise like first should be 3rd and last should be 6th.
please help me in resolving this problem.
warm regards in advance.
Best Answer