Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.



Re: Matrix search
Posted:
Jun 12, 2013 9:21 AM


Suppose in the same N x 4 matrix, in the first column if I want to start a search at a particular value run it till a particular value how to do it? If the first column elements are like 112 384 94 12 34 56 78 91 74 57 35 23 50 26 59 16 79 385 967 917. I want the search to start from a value less than 25 and run till a value less than 400. In this case it should start from 12 and end at 385. (This is an example matrix. Mine has more random numbers.) Thank You
dpb <none@non.net> wrote in message <kp9o7i$9iv$1@speranza.aioe.org>... > On 6/12/2013 6:19 AM, Narayanan wrote: > > How to do a logical operation wit a matrix column? I have a N x 4 > > matrix. If any value is greater than 2 or less than 8 in the first > > column then i have to print "VALID" else "INVALID". I am able to search > > the matrix with A(:,1) condition but unable to check the OR condition. > > >> v=randperm(8) > v = > 2 5 3 6 8 7 4 1 > >> s={'Y';'N'}; > >> v>2 & v<8 > ans = > 0 1 1 1 0 1 1 0 > >> sprintf('%s ', s{(v>2 & v<8)+1}) > ans = > Y N N N Y N N Y > >> > > Salt to suit... > > 



