Matlab: how to write column number to new column if boolean condition is met
I have a sample matrix similar to this one in matlab (although my real matrix contains many more columns)
List = [0,0,1;1,0,0;0,1,0;0,1,0;0,0,0]
List =
0 0 1
1 0 0
0 1 0
0 1 0
0 0 0
What I am trying to find is a way that I could sum conditions that are TRUE (= 1) into a new variable with only one column, but that indicates the column number in a structure like the following list
ListNew = 3 1 2 2 0
Is there a function or easy way to do this in Matlab?
+3
source to share
3 answers