Logical scalar values - operators, MATLAB in Engineering

Logical scalar values:

The MATLAB also has or and and operators which work element wise for the matrices:

1084_Logical scalar values.png

These operators will compare any of the two vectors or matrices, as long as they are of similar size, element-by-element, and return a vector or matrix of similar size of logical 1's and 0's. The operators |  | and && are only used with scalars, not matrices. For illustration,

>> v1 = [3 0 5 1];

>> v2 = [0 0 2 0];

>> v1 & v2

ans =

0  0  1  0

>> v1 | v2

ans =

1  0  1  1

>> v1 && v2

??? Operands to the || and && operators should be convertible to the logical scalar values.

1713_Logical scalar values1.png

As with numerical operators, it is significant to know that the operator precedence rules. Table shows the rules for the operators which have been covered faraway, in the order of the precedence.

 

Posted Date: 10/19/2012 6:00:14 AM | Location : United States







Related Discussions:- Logical scalar values - operators, Assignment Help, Ask Question on Logical scalar values - operators, Get Answer, Expert's Help, Logical scalar values - operators Discussions

Write discussion on Logical scalar values - operators
Your posts are moderated
Related Questions
Illustration of Subfunctions: This is an illustration of running this program: >> rectarea Please enter the length: 6 Please enter the width: 3 For a rectan

Illustration of Passing arguments to functions: Here is an illustration of calling this function: >> printrand() The random # is 0.94 As nothing is passed to

Solving 2 × 2 systems of equations: However this may be easy in a MATLAB, in normal finding solutions to the systems of equations is not. The systems which are 2 × 2 are, thou

Illustration of Vectors of structures: In this illustration, the packages are vector which has three elements. It is shown as a column vector. Each and every element is a stru

Built-in colormaps: The MATLAB has numerous built-in colormaps which are named; the reference page on colormap shows them. Calling the function colormap without passing any ar

True color matrice: The true color matrices are the other way to represent images. The true color matrices are 3-dimensional matrices. The first two coordinates are the coordi

Illustration of Preallocating a Vector: Illustration of calling the function: >> myveccumsum([5 9 4]) ans =     5  14  18 At the first time in the loop, outvec wil

Set Operations: The MATLAB has numerous built-in functions which perform set operations on vectors. These involve intersect, union, setdiff, unique, and setxor. All these func

Examine exponential function: The algorithm for the main script program is shown below:  Call a function eoption to show the menu and return the user's choice.  Loop

Use of built-in colormaps: MATLAB has built-in colormaps, it is also possible to generate others by using combinations of any colors. For illustration, the following generates