if i have a (M , N) binary matrix which M is number of rows and N is the number of column , and i want to count Number of 1 in each row and for each column , for example [1 0 1 1 0 1 1 1 1 0 1 0 ] the the output will be in new matrix like this [ 1 2 4 1]
Matrix = [ 0 1 1 1 0 0 1 0 1 1 1 0 1 1 0 1 0 1 1 0 1 1 0 0 1 1 1 1 0 1 1 1 1 1 1 0 1 0 0 1 0 0 1 0 0 1 1 1 1 0 1 1 0 1 1 0 0 1 0 1 ]Matrix_row = [3 1 2 0 1 2 1 2 2 4 1 0 5 1 1 0 1 4 0 0 2 2 1 1 ] Matrix_col = [0 0 0 0 0 0 0 0 0 0 0 1 0 2 0 0 0 0 0 1 3 2 2 1 1 2 1 2 2 2 1 1 2 1 1 1 3 2 1 1 ]
i need this solution because its a part of graduation project please he me
Best Answer