Illustration of logical vectors, MATLAB in Mathematics

Illustration of Logical vectors:

Calling the function appears to return similar vector as simply vec > 5, and summing the result still works to determine how many elements were greater than 5.

>> notlog = testvecgtn(vec,5)

notlog =

0        1  0  0  1  1

>> sum(notlog)

ans =

  3

Though, as before, it could not be used to index a vector as the elements are double, and not logical:

>> vec(notlog)

??? Subscript indices should either be real positive integers or logical.

 

 

 

Posted Date: 10/19/2012 5:53:26 AM | Location : United States







Related Discussions:- Illustration of logical vectors, Assignment Help, Ask Question on Illustration of logical vectors, Get Answer, Expert's Help, Illustration of logical vectors Discussions

Write discussion on Illustration of logical vectors
Your posts are moderated
Related Questions
Error-checking for integers: illustrations of running this script as shown below: >> readoneint Enter an integer: 9.5 Invalid! Enter an integer: 3.6 Invalid

Changing Dimensions: In addition to transpose operator, the MATLAB has some built-in functions which change the dimensions or configuration of matrices, involving fliplr, resh

Sorting The Sorting is a process of putting a list in order; either in descending (maximum to minimum), or ascending (minimum to maximum) order. For illustration, here is a li

Illustration of logical built-in functions: The function find returns the indices of a vector which meet certain criteria. For illustration, to find all the elements in a vect

Example of Minimum and Maximum Value For matrices, the functions min and max operate column wise by the default: >> mat = randint(2,4,[1 20]) mat =    9   10   1

Polar Form: Any complex number z = a + bi can be thought of as a point (a,b) or vector in the complex plane in which the horizontal axis is the real part of z, and the vertica

Fliplr function: The fliplr function "flips" the matrix from left to right (in another words the left-most column, the first column, become the last column and so on), and the

fprintf function - File function: The fprintf function really returns the number of bytes which was written to the file, therefore if you do not want to see that number, suppr

Dimensions - matrix: The size and length functions in the MATLAB are used to find array dimensions. Length function returns the number of elements in the vector. The size func

Illustration of Advanced file input and output: For illustration, to refer to the third number in the first element of the cell array: >> subjdata{1}(3) ans =