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].
The answer needed is [1 4], but both of your answers below give me [1
2 3 4].
Mike Miller <address@hidden> writes:
> 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
-------------------------------------------------------------
_____________________________
Julius O. Smith III <address@hidden>
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
-------------------------------------------------------------