MATLAB: How to apply OR operation to a matrix logical operationsMATLAB Hi folk, I need to apply the OR operation to the column of a matrix. Here an example: a=[0 0 1; 0 1 1];orMat(a)=[0 0 1] thanks Best Answer Your example is not the 'OR', it is the 'AND', of the columns. The 'OR' of the columns is done this way: b = any(a,1);The 'AND' would be done this way: b = all(a,1); Related SolutionsMATLAB: Logical operators on a logical matrix all(A,2)any(A,2) MATLAB: XOR operation a=[0 0] %example inputb=[a(1) a(2) xor(a(1),a(2))] %example output Related QuestionLogical operation on column of a matrixXOR operationMatrix operationHow to quickly obtain the row indices in the original matrix A for a sub-matrix BVector operationsSimple operations
Best Answer