help-octave
[Top][All Lists]

## Re: no way for simple matrix lookup ?

 From: Julius Smith Subject: Re: no way for simple matrix lookup ? Date: Fri, 18 Jun 2004 11:30:25 -0700

```How about A(diag(b',c)) ?

-- jos

At 10:33 AM 6/16/2004, D. Goel wrote:

```
```Mike, that doesn't work, your recipe below is the first thing I tried.

Example, A = [1 3; 2 4]
b=c=[1 2].

2 3 4].

> D = A(b,c)
>
> And your variable D will be a matrix with size(D)=[length(b),
> length(c)]. You can transform it into a vector using D=D(:), or you
> can do this:
>
> D = reshape(A(b, c), length(b)*length(c), 1)
>
> You don't have to loop over 'i'.
>
> Best,
>
> Mike
>
>
>
[...]

-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------
```
```
_____________________________
Assoc. Prof. of Music and (by courtesy) Electrical Engineering
CCRMA, Stanford University
http://www-ccrma.stanford.edu/~jos/

-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------

```