[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: values in a column vector between two scalars?
From: |
Robert McDonald |
Subject: |
Re: values in a column vector between two scalars? |
Date: |
Fri, 18 Mar 2011 16:52:16 -0500 |
On Fri, Mar 18, 2011 at 12:01 PM, pvkd44 <address@hidden> wrote:
> Hi, this is my first week using Octave.
>
> if I have a column vector A:
>
> 1
> 2
> 3
> 4
> 5
> 6
> 7
> 8
> 9
>
> And two scalars: B = 3, C = 7
>
> How do I make a new column vector D from A, only using the values which lie
> between B and C ?
>
> I would like D to be:
>
> 3
> 4
> 5
> 6
> 7
>
Try this:
x=20:30;
y=x( find( x>=23 & x<=27 ) )
returns
23 24 25 26 27
Is this what you're looking for?
Bob