I have matrix a. Then, I find which column in each row has number bigger than 1. The code is as below
a = 5 0 0 0 0 0 0 0 0 0 3 1 0 0 0 0 0 0 0 0 1 2 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0>> for cpart=1:size(a,1)b=a(cpart,:);row = find(b ~=0)endrow = 1row = 1 2row = 1 2row = 1 3
How can I put the row in a matrices ?(as shown below)
row = [1 0 1 2 1 2 1 3]
Best Answer