Logical built-in functions, MATLAB in Statistics

Logical Built-In Functions:

There are built-in functions in the MATLAB which are useful in conjunction with vectors or matrices of all logical true or false values; two of these are the functions 'any' and 'all'. The function 'any' returns a logical true when any element in a vector is logically true, and false if not. The function 'all' returns a logical true only when all elements are logically true. Here are some illustrations. For the variable vec1, all the elements are logical true therefore both any and all return true.

>> vec1 = [1 3 1 1 2];

>> any(vec1)

ans =

1

>> all(vec1)

ans =

1

For vec2, various elements are logical true so 'any' returns the true but 'all' returns false.

>> vec2 = [1 1 0 1]

vec2 =

1  1  0  1

>> any(vec2)

ans =

1

>> all(vec2)

ans =

0

Posted Date: 10/19/2012 5:54:11 AM | Location : United States







Related Discussions:- Logical built-in functions, Assignment Help, Ask Question on Logical built-in functions, Get Answer, Expert's Help, Logical built-in functions Discussions

Write discussion on Logical built-in functions
Your posts are moderated
Related Questions
Logical errors: The Logical errors are more complicated to locate, as they do not result in any error message. The logical error is a mistake in reasoning by the programmer, b

Function Stubs: The other common debugging method, which is used when there is a script main program which calls many functions, is to use the function stubs. A function stub

Operation on file: We concentrate first on the fgetl function that reads strings from the file one line at a time. The fgetl functions afford more control over how the data is

Use of function polyval: The better the curve fit, the more exact these interpolated and extrapolated values will be. By using the subplot function, we can loop to display the

Run-time or execution-time error: The Run-time, or execution-time, errors are found whenever a script or function is executing. With most of the languages, an illustration of

Core Objects: The Core Objects in MATLAB are the very fundamental graphics primitives. The description can be found under the MATLAB Help: Under the Contents tab, click the Ha

Illustration of Mode When there is more than one value with similar (highest) frequency, then the smaller value is mode. In the case below, as 3 and 8 appear twice in the vecto

Variable packages: Variable packages are now the vector of structures, hence each and every element in the vector is a structure. To show one element in the vector, an index i

Introduction and Purpose In the lectures and tutorials you have been introduced to a number of probability distributions. You have also learned that modelling any system (such

Graphics objects: The objects involve graphics primitives like lines and text, and also the axes used to orient the objects. These objects are organized hierarchically, and the