No products are associated with this question.
A =[1, 5,0,0; 2,4,0,0; 3, 2,6,4] [i1 j1] = find(A(:,2:end)) sz = size(A) out = sortrows([A(i1,1) A(sz(1)+sub2ind(sz- [0 1],i1,j1))],1)
[i2 j2 c] = find(A) t = j2~=1 out = sortrows([A(i2(t),1) c(t)],1)
AA = A(:,2:end) [i1,~] = find(AA) out = sortrows([A(i1,1) reshape(AA(AA~=0),,1)],1)
Play games and win prizes!Learn more