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
Removing Whitespace Characters: The MATLAB has functions which will eliminate trailing blanks from the end of a string and/or leading blanks from the starting of a string.

Illustration of Graphics properties: A particular property can also be exhibited, for illustration, to view the line width:     >> get(hl,'LineWidth')     ans =

i want to run 4 instances of my matlab code on 4 processor cores. im executing the job from head node. i created a parallel job and assigned number of workers. but i don''t get bac

Related Structure Functions: There are many functions which can be used with structures in a MATLAB. The function isstruct will return 1 for logical true when the variable arg


Example of Exponential function modular program: In order to view the distinction in the approximate value for e as n increases, the user kept choosing Limit & entering larger

Illustration of Image processing: This displays that there are 64 rows, or in another word, 64 colors, in this specific colormap. It also displays that the first five colors a

printrectarea function: function call: printrectarea(length, width) function header: function printrectarea(len, wid)   In the function call, there are two argume

Converting between the String and Number types: The MATLAB has many functions which convert numbers to strings in which each character element is a separate digit, and vice ve

Passing arguments to functions: In all these functions examples faraway, at least one of the arguments was passed in the function call to be the value(s) of the equivalent inp