help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: no way for simple matrix lookup ?


From: D. Goel
Subject: Re: no way for simple matrix lookup ?
Date: Wed, 16 Jun 2004 13:33:50 -0400
User-agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.2 (gnu/linux)

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
-------------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]