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
Use of logical vector: Determine how many elements in the vector vec were greater than 5, the sum function can be used on the resulting vector isg: >> sum(isg) ans =

Print an imaginary number: To print an imaginary number, the function disp will show both parts automatically: >> disp(z1)    4.0000 + 2.0000i The function fprint

This project requires you to use the ideas of Chapter 25 regarding maximization of a function. Here we assume that evolution has acted to generate highly efficient foragers. By hig

Error-Checking for Integers: As MATLAB uses the type double by default for all the values, to check to make confirm that the user has entered an integer, the program have to c

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 wer

Illustration of a recursive function: illustration is of a recursive function which does not return anything, but simply prints. The below function prtwords receives a sentenc

Illustration of Writing variables to a file: For illustration, in the below session in the Command Window, 3 variables are generated; these are then exhibited using who. Then,

Script a MATLAB program which meets the following speci cations: The program expects an input of a two-variable real-valued continuous function f : R^2--> R The program is to cal

Illustrations of Variable number of output arguments: In the illustrations shown here, the user should actually know the type of the argument in order to establish how many va

strvcat function - concatenation: The function strvcat will concatenate it vertically, that means that it will generate a column vector of the strings.   >> strvcat(fir