MATLAB: Hi, i want to find in a binary random matrice position of columns full of zeros (a column of zeros).. MATLABmatlab function is there any function in matlab which retur the position of a column ?? Best Answer You can use all and find to locate columns containing only zeros:>> X = randi(2,3,23)-1X = 0 0 0 0 1 1 1 0 1 1 0 0 1 1 1 1 1 1 1 1 1 0 0 1 0 0 0 0 0 1 0 1 1 0 0 0 1 1 0 0 1 0 0 1 0 0 0 1 0 1 0 0 1 1 1 1 0 0 0 0 1 1 0 1 0 1 1 1 0>> find(all(X==0,1))ans = 3 11 12 23 Related SolutionsMATLAB: How to place a cell array in another cell array using ‘find’ If I understood correctly:Ax = randi([0 1], 4, 960); %Demo data. No way I'm reformating your example to make it valid matlab syntax. [row, col] = find(A);blockidx = discretize(col, 1:60:size(A, 2));Bx = accumarray([row, blockidx], col, [], @(c) {sort(c).'})Note: I'm not working on the whole cell array here, just one of these 4x960 matrix as I've not understood what that had to do with the question. Possibly, you just want to above in a loop (or cellfun) operating over each element of the cell array. MATLAB: Removing zeros from column A(A==0) = [] Related QuestionNon-zero column valueLogical operation on column of a matrixDelete zeros rows and columnsChange binary string to decimalRemoving columns containing zeros
Best Answer