Thread Subject: MATLAB matrix help

Subject: MATLAB matrix help

From: iBlastWeb

Date: 26 Nov, 2009 09:02:03

Message: 1 of 3

I am supposed to create a 10x10 matrix an then Extract all 30<=aij<=50 in a vector b....that is find all elements that are between 30 and 50 and put them in a vector b.

I started like this below but it doesn't find the elements between 30 and 50.

A=100*rand(10);
A=fix(A)
x=find(30<=A<=50)

Subject: MATLAB matrix help

From: Jos (10584)

Date: 26 Nov, 2009 09:18:03

Message: 2 of 3

"iBlastWeb " <rada25krish@yahoo.co.uk> wrote in message <helg6b$l7h$1@fred.mathworks.com>...
> I am supposed to create a 10x10 matrix an then Extract all 30<=aij<=50 in a vector b....that is find all elements that are between 30 and 50 and put them in a vector b.
>
> I started like this below but it doesn't find the elements between 30 and 50.
>
> A=100*rand(10);
> A=fix(A)
> x=find(30<=A<=50)

use the logical operator &

q = 30 <= A & A <= 50

Jos

Subject: MATLAB matrix help

From: iBlastWeb

Date: 26 Nov, 2009 13:37:20

Message: 3 of 3

nice..thanks for your help

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Contact us at files@mathworks.com