
unique: Gives unique values in an array.Issorted(A): It returns 1 if elements are in sorted order and 0 if not.ismember(A, B): It returns an array of size A with 1 for all elements of A are found in B or else none.
intersect(A & B, ‘rows’): It returns rows common to both A and B.intersect(A & B): It is used to intersect A and B and returns the common values of A and B in sorted order.Please find below the various list of operators. MATLAB provides various set operators like a union, intersection, etc. bitor(a, b) – Bit-wise XOR of integers a and b.bitShift(a,k) – It is equivalent to get multiplied by 2 k.So, if k is negative then it shifts right and if k is positive then it shifts left.bitset(a, pos) – set bit at a specified location of a.bitget(a, pos) – Get bit at a specified position, in the array a.bit and(a,b) – Bitwise AND of integers a and b.Matlab provides the following bitwise operators Interestingly, MATLAB provides various functions for bitwise and, bitwise or, bitwise not operations and shift operation, etc. The Bitwise Operator symbols are |, &, and ^: The truth table is as follows: P The symbols & and || are the logical short circuit operators AND and OR.Īs it is clear by the name Bitwise Operators work on a bit-by-bit operation.
Short-circuit: These types of operators work on scalar and logical operations. The symbols used in these operators are: & (AND), |(OR) ~ (NOT) Element-wise: Element-wise operator operates on elements of logical arrays. Matlab provides two types of Logical Operators are as given below: The operator returns an array of the same size with values true and false depending on the result of an operation. As the name suggests it finds a relation between each element of two arrays and if a relation exists then it returns true or else false. These types of Operators can work with both scalar and non-scalar data. Array transpose (.’): If A is an array then A.’ is the transpose of A but for complex array A there is no complex conjugate like matrix transpose. Matrix transpose (‘): If A is a matrix then A’ will be its linear algebraic transpose and if A is complex then A’ will be a complex conjugate transpose of it. Array power (.^): ^p is matrix X to the power matrix unless both of them are scalar. Matrix power(^): X^p is X to the power p if p is scalar or if p is an integer the power is computed by repeated squaring. Array Left division (.\): A.\B is the matrix with elements B(i,j) \a(I,j). Matrix Left division (\): In this type of matrix multiplication, A is a by n matrix and B is a column vector. Array right division (./): The only difference is, in this case, it will B./A where both A and B must have the same size unless one of them is scalar. Matrix right division (/): For example, B/A is roughly the same as B*inv(A) where B and A are two matrices. Array Multiplication(.*): It is the element by element multiplication of two arrays for eg C= A.*B and both A and B should be of the same size. If both the operands are non-scalar then this operation can only happen if the number of columns in A is equal to a number of rows in B. Matrix Multiplication: If C= A*B then C is the linear algebraic product of A and B. A few things that we need to keep in mind while using this that both the values should be of the same size unless one of them is scalar. Subtraction operator (-): This operator is used to subtract two values as the name suggests. Addition Operator (+): This operator is used to add two values as the name suggests. The difference between them is the use of (.) symbol along with the operator in the case of Array arithmetic operators. Matlab provides two types of Arithmetic operatorsĪs the above two types suggest Arithmetic Operators used with one or more operands as arrays are Array arithmetic operators and with one or more operand as a matrix is matrix arithmetic operator. MATLAB offers the following type of operators: One more important fact to keep in mind is operators in MATLAB work for both scalar and non-scalar data. Hadoop, Data Science, Statistics & others